mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-12 21:18:53 +00:00
remove dependency on dcgettext()
While fixing issue #3110 I noticed there is exactly one place we use dcgettext() and that use is completely unnecessary. So remove it.
This commit is contained in:
parent
0b385f145c
commit
9f21e3792a
4 changed files with 6 additions and 56 deletions
|
@ -305,7 +305,7 @@ AC_CHECK_FUNCS( futimens clock_gettime )
|
||||||
AC_CHECK_DECL( [mkostemp], [ AC_CHECK_FUNCS([mkostemp]) ] )
|
AC_CHECK_DECL( [mkostemp], [ AC_CHECK_FUNCS([mkostemp]) ] )
|
||||||
|
|
||||||
if test x$local_gettext != xno; then
|
if test x$local_gettext != xno; then
|
||||||
AC_CHECK_FUNCS( gettext dcgettext )
|
AC_CHECK_FUNCS( gettext )
|
||||||
|
|
||||||
#
|
#
|
||||||
# The Makefile also needs to know if we have gettext, so it knows if
|
# The Makefile also needs to know if we have gettext, so it knows if
|
||||||
|
|
10
src/env.cpp
10
src/env.cpp
|
@ -9,7 +9,9 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#ifdef HAVE__NL_MSG_CAT_CNTR
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#endif
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -191,15 +193,13 @@ static void handle_locale(const wchar_t *env_var_name) {
|
||||||
const char *new_msg_locale = setlocale(LC_MESSAGES, NULL);
|
const char *new_msg_locale = setlocale(LC_MESSAGES, NULL);
|
||||||
debug(3, L"old LC_MESSAGES locale: '%s'", old_msg_locale);
|
debug(3, L"old LC_MESSAGES locale: '%s'", old_msg_locale);
|
||||||
debug(3, L"new LC_MESSAGES locale: '%s'", new_msg_locale);
|
debug(3, L"new LC_MESSAGES locale: '%s'", new_msg_locale);
|
||||||
|
#ifdef HAVE__NL_MSG_CAT_CNTR
|
||||||
if (strcmp(old_msg_locale, new_msg_locale)) {
|
if (strcmp(old_msg_locale, new_msg_locale)) {
|
||||||
// Try to make change known to gettext. Both changing _nl_msg_cat_cntr and calling dcgettext
|
// Make change known to GNU gettext.
|
||||||
// might potentially tell some gettext implementation that the translation strings should be
|
|
||||||
// reloaded. We do both and hope for the best.
|
|
||||||
debug(2, L"changing message locale from '%s' to '%s'", old_msg_locale, new_msg_locale);
|
|
||||||
extern int _nl_msg_cat_cntr;
|
extern int _nl_msg_cat_cntr;
|
||||||
_nl_msg_cat_cntr++;
|
_nl_msg_cat_cntr++;
|
||||||
fish_dcgettext("fish", "Changing language to English", LC_MESSAGES);
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if the specified variable is a locale variable.
|
/// Check if the specified variable is a locale variable.
|
||||||
|
|
|
@ -171,7 +171,6 @@ wchar_t *wcsndup(const wchar_t *in, size_t c) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_WCSLCPY
|
#ifndef HAVE_WCSLCPY
|
||||||
|
|
||||||
/*$OpenBSD: strlcpy.c,v 1.8 2003/06/17 21:56:24 millert Exp $*/
|
/*$OpenBSD: strlcpy.c,v 1.8 2003/06/17 21:56:24 millert Exp $*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -189,7 +188,6 @@ wchar_t *wcsndup(const wchar_t *in, size_t c) {
|
||||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
size_t wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz) {
|
size_t wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz) {
|
||||||
register wchar_t *d = dst;
|
register wchar_t *d = dst;
|
||||||
register const wchar_t *s = src;
|
register const wchar_t *s = src;
|
||||||
|
@ -212,11 +210,9 @@ size_t wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz) {
|
||||||
return s - src - 1;
|
return s - src - 1;
|
||||||
// Count does not include NUL.
|
// Count does not include NUL.
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_LRAND48_R
|
#ifndef HAVE_LRAND48_R
|
||||||
|
|
||||||
int lrand48_r(struct drand48_data *buffer, long int *result) {
|
int lrand48_r(struct drand48_data *buffer, long int *result) {
|
||||||
*result = rand_r(&buffer->seed);
|
*result = rand_r(&buffer->seed);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -226,20 +222,16 @@ int srand48_r(long int seedval, struct drand48_data *buffer) {
|
||||||
buffer->seed = (unsigned int)seedval;
|
buffer->seed = (unsigned int)seedval;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_FUTIMES
|
#ifndef HAVE_FUTIMES
|
||||||
|
|
||||||
int futimes(int fd, const struct timeval *times) {
|
int futimes(int fd, const struct timeval *times) {
|
||||||
errno = ENOSYS;
|
errno = ENOSYS;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_GETTEXT
|
#if HAVE_GETTEXT
|
||||||
|
|
||||||
char *fish_gettext(const char *msgid) {
|
char *fish_gettext(const char *msgid) {
|
||||||
return gettext(msgid);
|
return gettext(msgid);
|
||||||
;
|
;
|
||||||
|
@ -250,35 +242,10 @@ char *fish_bindtextdomain(const char *domainname, const char *dirname) {
|
||||||
}
|
}
|
||||||
|
|
||||||
char *fish_textdomain(const char *domainname) { return textdomain(domainname); }
|
char *fish_textdomain(const char *domainname) { return textdomain(domainname); }
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
char *fish_gettext(const char *msgid) { return (char *)msgid; }
|
char *fish_gettext(const char *msgid) { return (char *)msgid; }
|
||||||
|
|
||||||
char *fish_bindtextdomain(const char *domainname, const char *dirname) { return NULL; }
|
char *fish_bindtextdomain(const char *domainname, const char *dirname) { return NULL; }
|
||||||
|
|
||||||
char *fish_textdomain(const char *domainname) { return NULL; }
|
char *fish_textdomain(const char *domainname) { return NULL; }
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAVE_DCGETTEXT
|
|
||||||
|
|
||||||
char *fish_dcgettext(const char *domainname, const char *msgid, int category) {
|
|
||||||
return dcgettext(domainname, msgid, category);
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
char *fish_dcgettext(const char *domainname, const char *msgid, int category) {
|
|
||||||
return (char *)msgid;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE__NL_MSG_CAT_CNTR
|
|
||||||
|
|
||||||
int _nl_msg_cat_cntr = 0;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_KILLPG
|
#ifndef HAVE_KILLPG
|
||||||
|
@ -299,18 +266,12 @@ double nan(char *tagp) { return 0.0 / 0.0; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !HAVE_BROKEN_WCWIDTH
|
#if !HAVE_BROKEN_WCWIDTH
|
||||||
|
|
||||||
int fish_wcwidth(wchar_t wc) { return wcwidth(wc); }
|
int fish_wcwidth(wchar_t wc) { return wcwidth(wc); }
|
||||||
|
|
||||||
int fish_wcswidth(const wchar_t *str, size_t n) { return wcswidth(str, n); }
|
int fish_wcswidth(const wchar_t *str, size_t n) { return wcswidth(str, n); }
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static int mk_wcwidth(wchar_t wc);
|
static int mk_wcwidth(wchar_t wc);
|
||||||
static int mk_wcswidth(const wchar_t *pwcs, size_t n);
|
static int mk_wcswidth(const wchar_t *pwcs, size_t n);
|
||||||
|
|
||||||
int fish_wcwidth(wchar_t wc) { return mk_wcwidth(wc); }
|
int fish_wcwidth(wchar_t wc) { return mk_wcwidth(wc); }
|
||||||
|
|
||||||
int fish_wcswidth(const wchar_t *str, size_t n) { return mk_wcswidth(str, n); }
|
int fish_wcswidth(const wchar_t *str, size_t n) { return mk_wcswidth(str, n); }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -373,7 +334,6 @@ int fish_wcswidth(const wchar_t *str, size_t n) { return mk_wcswidth(str, n); }
|
||||||
*
|
*
|
||||||
* Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
|
* Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct interval {
|
struct interval {
|
||||||
int first;
|
int first;
|
||||||
int last;
|
int last;
|
||||||
|
@ -502,5 +462,4 @@ static int mk_wcswidth(const wchar_t *pwcs, size_t n) {
|
||||||
}
|
}
|
||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAVE_BROKEN_WCWIDTH
|
#endif // HAVE_BROKEN_WCWIDTH
|
||||||
|
|
|
@ -120,15 +120,6 @@ char *fish_bindtextdomain(const char *domainname, const char *dirname);
|
||||||
/// Cover for textdomain().
|
/// Cover for textdomain().
|
||||||
char *fish_textdomain(const char *domainname);
|
char *fish_textdomain(const char *domainname);
|
||||||
|
|
||||||
/// Cover for dcgettext.
|
|
||||||
char *fish_dcgettext(const char *domainname, const char *msgid, int category);
|
|
||||||
|
|
||||||
#ifndef HAVE__NL_MSG_CAT_CNTR
|
|
||||||
/// Some gettext implementation use have this variable, and by increasing it, one can tell the
|
|
||||||
/// system that the translations need to be reloaded.
|
|
||||||
extern int _nl_msg_cat_cntr;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_KILLPG
|
#ifndef HAVE_KILLPG
|
||||||
/// Send specified signal to specified process group.
|
/// Send specified signal to specified process group.
|
||||||
int killpg(int pgr, int sig);
|
int killpg(int pgr, int sig);
|
||||||
|
|
Loading…
Reference in a new issue