X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=intl%2Ffinddomain.c;h=4992a8c9e3352ec6c52086d05110e663753348c1;hb=b01a9dc187d9cd396a57463ad27511379dcdc9cd;hp=f8ed8da011539b28a2f6c39020080a53005d7ad9;hpb=b92c96554385bcbc91262cd9a83766f422552564;p=lyx.git diff --git a/intl/finddomain.c b/intl/finddomain.c index f8ed8da011..4992a8c9e3 100644 --- a/intl/finddomain.c +++ b/intl/finddomain.c @@ -1,69 +1,44 @@ /* 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, 2003 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + 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 @@ */ /* List of already loaded domains. */ - static struct loaded_l10nfile *_nl_loaded_domains; @@ -72,10 +47,8 @@ static struct loaded_l10nfile *_nl_loaded_domains; established bindings. */ struct loaded_l10nfile * internal_function -_nl_find_domain (dirname, locale, domainname) - const char *dirname; - char *locale; - const char *domainname; +_nl_find_domain (const char *dirname, char *locale, + const char *domainname, struct binding *domainbinding) { struct loaded_l10nfile *retval; const char *language; @@ -121,7 +94,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; @@ -129,7 +102,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; @@ -176,14 +149,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; } @@ -193,13 +166,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; @@ -209,9 +185,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