X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=intl%2Ffinddomain.c;h=e12a638d5c302b3cdce0a721bafc55475da5decb;hb=2365f8d70c50afbfd6be69a4076ea6e78fb5485d;hp=5409565fd3d8d415d0c8c01a0de8b6d51f3ff7ee;hpb=01f0fe5e0450edf168c1f612feb93cf588e4e7ea;p=deliverable%2Fbinutils-gdb.git diff --git a/intl/finddomain.c b/intl/finddomain.c index 5409565fd3..e12a638d5c 100644 --- a/intl/finddomain.c +++ b/intl/finddomain.c @@ -1,64 +1,40 @@ /* Handle list of needed message catalogs - Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. - Written by Ulrich Drepper , 1995. + Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. + Written by Ulrich Drepper , 1995. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published + by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ #ifdef HAVE_CONFIG_H # include #endif -#include -#include #include #include - -#if defined STDC_HEADERS || defined _LIBC -# include -#else -# ifdef HAVE_MALLOC_H -# include -# else -void free (); -# endif -#endif - -#if defined HAVE_STRING_H || defined _LIBC -# include -#else -# include -# ifndef memcpy -# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num) -# endif -#endif -#if !HAVE_STRCHR && !defined _LIBC -# ifndef strchr -# define strchr index -# endif -#endif +#include +#include #if defined HAVE_UNISTD_H || defined _LIBC # include #endif -#include "gettext.h" #include "gettextP.h" #ifdef _LIBC # include #else -# include "libgettext.h" +# include "libgnuintl.h" #endif /* @@ end of prolog @@ */ @@ -71,10 +47,11 @@ static struct loaded_l10nfile *_nl_loaded_domains; established bindings. */ struct loaded_l10nfile * internal_function -_nl_find_domain (dirname, locale, domainname) +_nl_find_domain (dirname, locale, domainname, domainbinding) const char *dirname; char *locale; const char *domainname; + struct binding *domainbinding; { struct loaded_l10nfile *retval; const char *language; @@ -120,7 +97,7 @@ _nl_find_domain (dirname, locale, domainname) int cnt; if (retval->decided == 0) - _nl_load_domain (retval); + _nl_load_domain (retval, domainbinding); if (retval->data != NULL) return retval; @@ -128,7 +105,7 @@ _nl_find_domain (dirname, locale, domainname) for (cnt = 0; retval->successor[cnt] != NULL; ++cnt) { if (retval->successor[cnt]->decided == 0) - _nl_load_domain (retval->successor[cnt]); + _nl_load_domain (retval->successor[cnt], domainbinding); if (retval->successor[cnt]->data != NULL) break; @@ -175,14 +152,14 @@ _nl_find_domain (dirname, locale, domainname) return NULL; if (retval->decided == 0) - _nl_load_domain (retval); + _nl_load_domain (retval, domainbinding); if (retval->data == NULL) { int cnt; for (cnt = 0; retval->successor[cnt] != NULL; ++cnt) { if (retval->successor[cnt]->decided == 0) - _nl_load_domain (retval->successor[cnt]); + _nl_load_domain (retval->successor[cnt], domainbinding); if (retval->successor[cnt]->data != NULL) break; } @@ -192,13 +169,16 @@ _nl_find_domain (dirname, locale, domainname) if (alias_value != NULL) free (locale); + /* The space for normalized_codeset is dynamically allocated. Free it. */ + if (mask & XPG_NORM_CODESET) + free ((void *) normalized_codeset); + return retval; } #ifdef _LIBC -static void __attribute__ ((unused)) -free_mem (void) +libc_freeres_fn (free_mem) { struct loaded_l10nfile *runp = _nl_loaded_domains; @@ -208,9 +188,8 @@ free_mem (void) if (runp->data != NULL) _nl_unload_domain ((struct loaded_domain *) runp->data); runp = runp->next; + free ((char *) here->filename); free (here); } } - -text_set_element (__libc_subfreeres, free_mem); #endif