+2002-12-12 Bruno Haible <bruno@clisp.org>
+
+ * dcigettext.c (INTVARDEF): Correct fallback definition.
+
+2002-11-19 Ulrich Drepper <drepper@redhat.com>
+
+ * localealias.c (read_alias_file): Use only about 400 bytes of stack
+ space instead of 16k.
+
+2002-10-30 Jakub Jelinek <jakub@redhat.com>
+
+ * finddomain.c (free_mem): Use libc_freeres_fn macro, remove
+ text_set_element.
+ * dcigettext.c (free_mem): Likewise.
+
+2002-10-25 Jakub Jelinek <jakub@redhat.com>
+
+ * localealias.c (libc_freeres_ptr): Define if !_LIBC.
+ (string_space, map): Add libc_freeres_ptr.
+ (free_mem): Remove.
+
+2002-09-19 Bruno Haible <bruno@clisp.org>
+
+ * dcigettext.c (DCIGETTEXT): Restore errno only right before
+ returning.
+
+2002-09-01 Roland McGrath <roland@redhat.com>
+
+ * localealias.c [__GNUC__]: #undef alloca before #define.
+
+2002-08-30 Roland McGrath <roland@redhat.com>
+
+ * dcigettext.c (DCIGETTEXT) [_LIBC]: Check for bogus CATEGORY.
+ [_LIBC] (category_to_name): Don't define the function. Instead define
+ a macro using _nl_category_names.
+
+2002-08-04 Ulrich Drepper <drepper@redhat.com>
+
+ * dcigettext.c: Define _nl_default_dirname_internal as hidden alias
+ and use it.
+ * bindtextdom.c: Use _nl_default_dirname_internal.
+
+2002-08-03 Roland McGrath <roland@redhat.com>
+
+ * dcigettext.c (guess_category_value): Use __current_locale_name
+ instead of calling setlocale.
+
+2002-08-02 Roland McGrath <roland@redhat.com>
+
+ * loadmsgcat.c (_nl_init_domain_conv): Use _NL_CURRENT.
+
+2002-07-30 Roland McGrath <roland@redhat.com>
+
+ * loadmsgcat.c [__GNUC__]: #undef alloca before defining it.
+
+2002-05-01 Ulrich Drepper <drepper@redhat.com>
+
+ Revert 2002-04-09 change.
+ * dcngettext.c (__dcngettext_internal): Remove alias.
+ * dngettext.c: Use __dcngettext instead of __dcngettext_internal.
+ * ngettext.c: Likewise.
+
2002-11-07 Bruno Haible <bruno@clisp.org>
* Makefile.in (mostlyclean): Remove object files on OS/2 as well.
__argz_stringify.
2002-04-08 Ulrich Drepper <drepper@redhat.com>
+
* dcgettext.c (__dcgettext): Use INTDEF to define alias.
* dgettext.c: Call __dcgettext_internal instead of __dcgettext.
* gettext.c: Likewise.
/* Contains the default location of the message catalogs. */
extern const char _nl_default_dirname[];
+#ifdef _LIBC
+extern const char _nl_default_dirname_internal[] attribute_hidden;
+#else
+# define INTUSE(name) name
+#endif
/* List with bindings of specific domains. */
extern struct binding *_nl_domain_bindings;
char *result = binding->dirname;
if (strcmp (dirname, result) != 0)
{
- if (strcmp (dirname, _nl_default_dirname) == 0)
- result = (char *) _nl_default_dirname;
+ if (strcmp (dirname, INTUSE(_nl_default_dirname)) == 0)
+ result = (char *) INTUSE(_nl_default_dirname);
else
{
#if defined _LIBC || defined HAVE_STRDUP
if (__builtin_expect (result != NULL, 1))
{
- if (binding->dirname != _nl_default_dirname)
+ if (binding->dirname != INTUSE(_nl_default_dirname))
free (binding->dirname);
binding->dirname = result;
{
/* Simply return the default values. */
if (dirnamep)
- *dirnamep = _nl_default_dirname;
+ *dirnamep = INTUSE(_nl_default_dirname);
if (codesetp)
*codesetp = NULL;
}
if (dirname == NULL)
/* The default value. */
- dirname = _nl_default_dirname;
+ dirname = INTUSE(_nl_default_dirname);
else
{
- if (strcmp (dirname, _nl_default_dirname) == 0)
- dirname = _nl_default_dirname;
+ if (strcmp (dirname, INTUSE(_nl_default_dirname)) == 0)
+ dirname = INTUSE(_nl_default_dirname);
else
{
char *result;
}
else
/* The default value. */
- new_binding->dirname = (char *) _nl_default_dirname;
+ new_binding->dirname = (char *) INTUSE(_nl_default_dirname);
new_binding->codeset_cntr = 0;
if (0)
{
failed_codeset:
- if (new_binding->dirname != _nl_default_dirname)
+ if (new_binding->dirname != INTUSE(_nl_default_dirname))
free (new_binding->dirname);
failed_dirname:
free (new_binding);
}
#endif
+#ifndef INTVARDEF
+# define INTVARDEF(name)
+#endif
+#ifndef INTUSE
+# define INTUSE(name) name
+#endif
+
/* Name of the default domain used for gettext(3) prior any call to
textdomain(3). The default value for this is "messages". */
const char _nl_default_default_domain[] attribute_hidden = "messages";
extern const char _nl_default_dirname[];
#else
const char _nl_default_dirname[] = LOCALEDIR;
+INTVARDEF (_nl_default_dirname)
#endif
/* List with bindings of specific domains created by bindtextdomain()
const char *translation,
size_t translation_len))
internal_function;
-static const char *category_to_name PARAMS ((int category)) internal_function;
static const char *guess_category_value PARAMS ((int category,
const char *categoryname))
internal_function;
+#ifdef _LIBC
+# include "../locale/localeinfo.h"
+# define category_to_name(category) _nl_category_names[category]
+#else
+static const char *category_to_name PARAMS ((int category)) internal_function;
+#endif
/* For those loosing systems which don't have `alloca' we have to add
if (msgid1 == NULL)
return NULL;
+#ifdef _LIBC
+ if (category < 0 || category >= __LC_LAST || category == LC_ALL)
+ /* Bogus. */
+ return (plural == 0
+ ? (char *) msgid1
+ /* Use the Germanic plural rule. */
+ : n == 1 ? (char *) msgid1 : (char *) msgid2);
+#endif
+
__libc_rwlock_rdlock (_nl_state_lock);
/* If DOMAINNAME is NULL, we are interested in the default domain. If
}
if (binding == NULL)
- dirname = (char *) _nl_default_dirname;
+ dirname = (char *) INTUSE(_nl_default_dirname);
else if (IS_ABSOLUTE_PATH (binding->dirname))
dirname = binding->dirname;
else
/* Found the translation of MSGID1 in domain DOMAIN:
starting at RETVAL, RETLEN bytes. */
FREE_BLOCKS (block_list);
- __set_errno (saved_errno);
#if defined HAVE_TSEARCH || defined _LIBC
if (foundp == NULL)
{
(*foundp)->translation_length = retlen;
}
#endif
+ __set_errno (saved_errno);
+
/* Now deal with plural. */
if (plural)
retval = plural_lookup (domain, n, retval, retlen);
return (char *) p;
}
-
+#ifndef _LIBC
/* Return string representation of locale CATEGORY. */
static const char *
internal_function
return retval;
}
+#endif
/* Guess value of current locale from value of the environment variables. */
static const char *
`LC_xxx', and `LANG'. On some systems this can be done by the
`setlocale' function itself. */
#ifdef _LIBC
- retval = setlocale (category, NULL);
+ retval = __current_locale_name (category);
#else
retval = _nl_locale_name (category, categoryname);
#endif
#ifdef _LIBC
/* If we want to free all resources we have to do some work at
program's end. */
-static void __attribute__ ((unused))
-free_mem (void)
+libc_freeres_fn (free_mem)
{
void *old;
{
struct binding *oldp = _nl_domain_bindings;
_nl_domain_bindings = _nl_domain_bindings->next;
- if (oldp->dirname != _nl_default_dirname)
+ if (oldp->dirname != INTUSE(_nl_default_dirname))
/* Yes, this is a pointer comparison. */
free (oldp->dirname);
free (oldp->codeset);
free (old);
}
}
-
-text_set_element (__libc_subfreeres, free_mem);
#endif
#ifdef _LIBC
/* Alias for function name in GNU C Library. */
-INTDEF(__dcngettext)
weak_alias (__dcngettext, dcngettext);
#endif
prefix. So we have to make a difference here. */
#ifdef _LIBC
# define DNGETTEXT __dngettext
-# define DCNGETTEXT INTUSE(__dcngettext)
+# define DCNGETTEXT __dcngettext
#else
# define DNGETTEXT libintl_dngettext
# define DCNGETTEXT libintl_dcngettext
#ifdef _LIBC
-static void __attribute__ ((unused))
-free_mem (void)
+libc_freeres_fn (free_mem)
{
struct loaded_l10nfile *runp = _nl_loaded_domains;
free (here);
}
}
-
-text_set_element (__libc_subfreeres, free_mem);
#endif
#include <sys/stat.h>
#ifdef __GNUC__
+# undef alloca
# define alloca __builtin_alloca
# define HAVE_ALLOCA 1
#else
if (outcharset == NULL || outcharset[0] == '\0')
{
# ifdef _LIBC
- outcharset = (*_nl_current[LC_CTYPE])->values[_NL_ITEM_INDEX (CODESET)].string;
+ outcharset = _NL_CURRENT (LC_CTYPE, CODESET);
# else
# if HAVE_ICONV
extern const char *locale_charset PARAMS ((void));
#include <sys/types.h>
#ifdef __GNUC__
+# undef alloca
# define alloca __builtin_alloca
# define HAVE_ALLOCA 1
#else
};
-static char *string_space;
+#ifndef _LIBC
+# define libc_freeres_ptr(decl) decl
+#endif
+
+libc_freeres_ptr (static char *string_space);
static size_t string_space_act;
static size_t string_space_max;
-static struct alias_map *map;
+libc_freeres_ptr (static struct alias_map *map);
static size_t nmap;
static size_t maxmap;
a) we are only interested in the first two fields
b) these fields must be usable as file names and so must not
be that long
- */
- char buf[BUFSIZ];
+ We avoid a multi-kilobyte buffer here since this would use up
+ stack space which we might not have if the program ran out of
+ memory. */
+ char buf[400];
char *alias;
char *value;
char *cp;
/* EOF reached. */
break;
- /* Possibly not the whole line fits into the buffer. Ignore
- the rest of the line. */
- if (strchr (buf, '\n') == NULL)
- {
- char altbuf[BUFSIZ];
- do
- if (FGETS (altbuf, sizeof altbuf, fp) == NULL)
- /* Make sure the inner loop will be left. The outer loop
- will exit at the `feof' test. */
- break;
- while (strchr (altbuf, '\n') == NULL);
- }
-
cp = buf;
/* Ignore leading white space. */
while (isspace ((unsigned char) cp[0]))
++added;
}
}
+
+ /* Possibly not the whole line fits into the buffer. Ignore
+ the rest of the line. */
+ while (strchr (buf, '\n') == NULL)
+ if (FGETS (buf, sizeof buf, fp) == NULL)
+ /* Make sure the inner loop will be left. The outer loop
+ will exit at the `feof' test. */
+ break;
}
/* Should we test for ferror()? I think we have to silently ignore
}
-#ifdef _LIBC
-static void __attribute__ ((unused))
-free_mem (void)
-{
- if (string_space != NULL)
- free (string_space);
- if (map != NULL)
- free (map);
-}
-text_set_element (__libc_subfreeres, free_mem);
-#endif
-
-
static int
alias_compare (map1, map2)
const struct alias_map *map1;
prefix. So we have to make a difference here. */
#ifdef _LIBC
# define NGETTEXT __ngettext
-# define DCNGETTEXT INTUSE(__dcngettext)
+# define DCNGETTEXT __dcngettext
#else
# define NGETTEXT libintl_ngettext
# define DCNGETTEXT libintl_dcngettext