1 /* Implementation of the internal dcigettext function.
2 Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
19 /* Tell glibc's <string.h> to provide a prototype for mempcpy().
20 This must come before <config.h> because <config.h> may include
21 <features.h>, and once <features.h> has been included, it's too late. */
23 # define _GNU_SOURCE 1
30 #include <sys/types.h>
32 #if defined __GNUC__ && !defined C_ALLOCA
33 # define alloca __builtin_alloca
34 # define HAVE_ALLOCA 1
36 # if (defined HAVE_ALLOCA_H || defined _LIBC) && !defined C_ALLOCA
54 # define __set_errno(val) errno = (val)
57 #if defined STDC_HEADERS || defined _LIBC
68 #if defined HAVE_STRING_H || defined _LIBC
73 #if !HAVE_STRCHR && !defined _LIBC
79 #if defined HAVE_UNISTD_H || defined _LIBC
83 #if defined HAVE_LOCALE_H || defined _LIBC
87 #if defined HAVE_SYS_PARAM_H || defined _LIBC
88 # include <sys/param.h>
96 # include "libgettext.h"
98 #include "hash-string.h"
100 /* Thread safetyness. */
102 # include <bits/libc-lock.h>
104 /* Provide dummy implementation if this is outside glibc. */
105 # define __libc_lock_define_initialized(CLASS, NAME)
106 # define __libc_lock_lock(NAME)
107 # define __libc_lock_unlock(NAME)
108 # define __libc_rwlock_define_initialized(CLASS, NAME)
109 # define __libc_rwlock_rdlock(NAME)
110 # define __libc_rwlock_unlock(NAME)
113 /* @@ end of prolog @@ */
116 /* Rename the non ANSI C functions. This is required by the standard
117 because some ANSI C functions will require linking with this object
118 file and the name space must not be polluted. */
119 # define getcwd __getcwd
121 # define stpcpy __stpcpy
124 # if !defined HAVE_GETCWD
126 # define getcwd(buf, max) getwd (buf)
131 static char *stpcpy PARAMS ((char *dest, const char *src));
133 # ifndef HAVE_MEMPCPY
134 static void *mempcpy PARAMS ((void *dest, const void *src, size_t n));
138 /* Amount to increase buffer size by in each try. */
141 /* The following is from pathmax.h. */
142 /* Non-POSIX BSD systems might have gcc's limits.h, which doesn't define
143 PATH_MAX but might cause redefinition warnings when sys/param.h is
144 later included (as on MORE/BSD 4.3). */
145 #if defined _POSIX_VERSION || (defined HAVE_LIMITS_H && !defined __GNUC__)
149 #ifndef _POSIX_PATH_MAX
150 # define _POSIX_PATH_MAX 255
153 #if !defined PATH_MAX && defined _PC_PATH_MAX
154 # define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 : pathconf ("/", _PC_PATH_MAX))
157 /* Don't include sys/param.h if it already has been. */
158 #if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN
159 # include <sys/param.h>
162 #if !defined PATH_MAX && defined MAXPATHLEN
163 # define PATH_MAX MAXPATHLEN
167 # define PATH_MAX _POSIX_PATH_MAX
170 /* XPG3 defines the result of `setlocale (category, NULL)' as:
171 ``Directs `setlocale()' to query `category' and return the current
172 setting of `local'.''
173 However it does not specify the exact format. And even worse: POSIX
174 defines this not at all. So we can use this feature only on selected
175 system (e.g. those using GNU C Library). */
177 # define HAVE_LOCALE_NULL
180 /* We want to allocate a string at the end of the struct. gcc makes
188 /* This is the type used for the search tree where known translations
190 struct known_translation_t
192 /* Domain in which to search. */
196 unsigned long int plindex;
201 /* State of the catalog counter at the point the string was found. */
204 /* And finally the translation. */
205 const char *translation;
207 /* Pointer to the string in question. */
211 /* Root of the search tree with known translations. We can use this
212 only if the system provides the `tsearch' function family. */
213 #if defined HAVE_TSEARCH || defined _LIBC
219 # define tsearch __tsearch
222 /* Function to compare two entries in the table of known translations. */
224 transcmp (const void *p1, const void *p2)
226 struct known_translation_t *s1 = (struct known_translation_t *) p1;
227 struct known_translation_t *s2 = (struct known_translation_t *) p2;
230 result = strcmp (s1->msgid, s2->msgid);
233 result = strcmp (s1->domain, s2->domain);
236 result = s1->plindex - s2->plindex;
238 /* We compare the category last (though this is the cheapest
239 operation) since it is hopefully always the same (namely
241 result = s1->category - s2->category;
249 /* Name of the default domain used for gettext(3) prior any call to
250 textdomain(3). The default value for this is "messages". */
251 const char _nl_default_default_domain[] = "messages";
253 /* Value used as the default domain for gettext(3). */
254 const char *_nl_current_default_domain = _nl_default_default_domain;
256 /* Contains the default location of the message catalogs. */
257 const char _nl_default_dirname[] = GNULOCALEDIR;
259 /* List with bindings of specific domains created by bindtextdomain()
261 struct binding *_nl_domain_bindings;
263 /* Prototypes for local functions. */
264 static unsigned long int plural_eval (struct expression *pexp,
265 unsigned long int n) internal_function;
266 static const char *category_to_name PARAMS ((int category)) internal_function;
267 static const char *guess_category_value PARAMS ((int category,
268 const char *categoryname))
272 /* For those loosing systems which don't have `alloca' we have to add
273 some additional code emulating it. */
275 /* Nothing has to be done. */
276 # define ADD_BLOCK(list, address) /* nothing */
277 # define FREE_BLOCKS(list) /* nothing */
282 struct block_list *next;
284 # define ADD_BLOCK(list, addr) \
286 struct block_list *newp = (struct block_list *) malloc (sizeof (*newp)); \
287 /* If we cannot get a free block we cannot add the new element to \
289 if (newp != NULL) { \
290 newp->address = (addr); \
291 newp->next = (list); \
295 # define FREE_BLOCKS(list) \
297 while (list != NULL) { \
298 struct block_list *old = list; \
304 # define alloca(size) (malloc (size))
305 #endif /* have alloca */
308 /* Names for the libintl functions are a problem. They must not clash
309 with existing names and they should follow ANSI C. But this source
310 code is also used in GNU C Library where the names have a __
311 prefix. So we have to make a difference here. */
313 # define DCIGETTEXT __dcigettext
315 # define DCIGETTEXT dcigettext__
318 /* Lock variable to protect the global data in the gettext implementation. */
319 __libc_rwlock_define_initialized (, _nl_state_lock)
321 /* Checking whether the binaries runs SUID must be done and glibc provides
322 easier methods therefore we make a difference here. */
324 # define ENABLE_SECURE __libc_enable_secure
325 # define DETERMINE_SECURE
327 static int enable_secure;
328 # define ENABLE_SECURE (enable_secure == 1)
329 # define DETERMINE_SECURE \
330 if (enable_secure == 0) \
332 if (getuid () != geteuid () || getgid () != getegid ()) \
335 enable_secure = -1; \
339 /* Look up MSGID in the DOMAINNAME message catalog for the current
340 CATEGORY locale and, if PLURAL is nonzero, search over string
341 depending on the plural form determined by N. */
343 DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category)
344 const char *domainname;
352 struct block_list *block_list = NULL;
354 struct loaded_l10nfile *domain;
355 struct binding *binding;
356 const char *categoryname;
357 const char *categoryvalue;
358 char *dirname, *xdomainname;
362 #if defined HAVE_TSEARCH || defined _LIBC
363 struct known_translation_t *search;
364 struct known_translation_t **foundp = NULL;
367 size_t domainname_len;
369 /* If no real MSGID is given return NULL. */
373 __libc_rwlock_rdlock (_nl_state_lock);
375 #if defined HAVE_TSEARCH || defined _LIBC
376 msgid_len = strlen (msgid1) + 1;
380 /* Try to find the translation among those which we found at
382 search = (struct known_translation_t *) alloca (sizeof (*search)
384 memcpy (search->msgid, msgid1, msgid_len);
385 search->domain = (char *) domainname;
387 search->category = category;
389 foundp = (struct known_translation_t **) tfind (search, &root, transcmp);
390 if (foundp != NULL && (*foundp)->counter == _nl_msg_cat_cntr)
392 __libc_rwlock_unlock (_nl_state_lock);
393 return (char *) (*foundp)->translation;
398 /* Preserve the `errno' value. */
401 /* See whether this is a SUID binary or not. */
404 /* If DOMAINNAME is NULL, we are interested in the default domain. If
405 CATEGORY is not LC_MESSAGES this might not make much sense but the
406 definition left this undefined. */
407 if (domainname == NULL)
408 domainname = _nl_current_default_domain;
410 /* First find matching binding. */
411 for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next)
413 int compare = strcmp (domainname, binding->domainname);
419 /* It is not in the list. */
426 dirname = (char *) _nl_default_dirname;
427 else if (binding->dirname[0] == '/')
428 dirname = binding->dirname;
431 /* We have a relative path. Make it absolute now. */
432 size_t dirname_len = strlen (binding->dirname) + 1;
436 path_max = (unsigned int) PATH_MAX;
437 path_max += 2; /* The getcwd docs say to do this. */
439 dirname = (char *) alloca (path_max + dirname_len);
440 ADD_BLOCK (block_list, dirname);
443 while ((ret = getcwd (dirname, path_max)) == NULL && errno == ERANGE)
445 path_max += PATH_INCR;
446 dirname = (char *) alloca (path_max + dirname_len);
447 ADD_BLOCK (block_list, dirname);
453 /* We cannot get the current working directory. Don't signal an
454 error but simply return the default string. */
455 FREE_BLOCKS (block_list);
456 __set_errno (saved_errno);
459 /* Use the Germanic plural rule. */
460 : n == 1 ? (char *) msgid1 : (char *) msgid2);
463 stpcpy (stpcpy (strchr (dirname, '\0'), "/"), binding->dirname);
466 /* Now determine the symbolic name of CATEGORY and its value. */
467 categoryname = category_to_name (category);
468 categoryvalue = guess_category_value (category, categoryname);
470 domainname_len = strlen (domainname);
471 xdomainname = (char *) alloca (strlen (categoryname)
472 + domainname_len + 5);
473 ADD_BLOCK (block_list, xdomainname);
475 stpcpy (mempcpy (stpcpy (stpcpy (xdomainname, categoryname), "/"),
476 domainname, domainname_len),
479 /* Creating working area. */
480 single_locale = (char *) alloca (strlen (categoryvalue) + 1);
481 ADD_BLOCK (block_list, single_locale);
484 /* Search for the given string. This is a loop because we perhaps
485 got an ordered list of languages to consider for the translation. */
488 /* Make CATEGORYVALUE point to the next element of the list. */
489 while (categoryvalue[0] != '\0' && categoryvalue[0] == ':')
491 if (categoryvalue[0] == '\0')
493 /* The whole contents of CATEGORYVALUE has been searched but
494 no valid entry has been found. We solve this situation
495 by implicitly appending a "C" entry, i.e. no translation
497 single_locale[0] = 'C';
498 single_locale[1] = '\0';
502 char *cp = single_locale;
503 while (categoryvalue[0] != '\0' && categoryvalue[0] != ':')
504 *cp++ = *categoryvalue++;
507 /* When this is a SUID binary we must not allow accessing files
508 outside the dedicated directories. */
510 && (memchr (single_locale, '/',
511 _nl_find_language (single_locale) - single_locale)
513 /* Ingore this entry. */
517 /* If the current locale value is C (or POSIX) we don't load a
518 domain. Return the MSGID. */
519 if (strcmp (single_locale, "C") == 0
520 || strcmp (single_locale, "POSIX") == 0)
522 FREE_BLOCKS (block_list);
523 __libc_rwlock_unlock (_nl_state_lock);
524 __set_errno (saved_errno);
527 /* Use the Germanic plural rule. */
528 : n == 1 ? (char *) msgid1 : (char *) msgid2);
532 /* Find structure describing the message catalog matching the
533 DOMAINNAME and CATEGORY. */
534 domain = _nl_find_domain (dirname, single_locale, xdomainname, binding);
538 #if defined HAVE_TSEARCH || defined _LIBC
539 struct loaded_domain *domaindata =
540 (struct loaded_domain *) domain->data;
541 unsigned long int index = 0;
545 /* Try to find the translation among those which we
546 found at some time. */
547 search = (struct known_translation_t *) alloca (sizeof (*search)
549 memcpy (search->msgid, msgid1, msgid_len);
550 search->domain = (char *) domainname;
551 search->plindex = plural_eval (domaindata->plural, n);
552 if (search->plindex >= domaindata->nplurals)
553 /* This should never happen. It means the plural expression
554 and the given maximum value do not match. */
556 index = search->plindex;
557 search->category = category;
559 foundp = (struct known_translation_t **) tfind (search, &root,
561 if (foundp != NULL && (*foundp)->counter == _nl_msg_cat_cntr)
563 __libc_rwlock_unlock (_nl_state_lock);
564 return (char *) (*foundp)->translation;
569 retval = _nl_find_msg (domain, msgid1, index);
575 for (cnt = 0; domain->successor[cnt] != NULL; ++cnt)
577 retval = _nl_find_msg (domain->successor[cnt], msgid1,
587 FREE_BLOCKS (block_list);
588 __set_errno (saved_errno);
589 #if defined HAVE_TSEARCH || defined _LIBC
592 /* Create a new entry and add it to the search tree. */
593 struct known_translation_t *newp;
595 newp = (struct known_translation_t *)
596 malloc (sizeof (*newp) + msgid_len
597 + domainname_len + 1 - ZERO);
600 newp->domain = mempcpy (newp->msgid, msgid1, msgid_len);
601 memcpy (newp->domain, domainname, domainname_len + 1);
602 newp->plindex = index;
603 newp->category = category;
604 newp->counter = _nl_msg_cat_cntr;
605 newp->translation = retval;
607 /* Insert the entry in the search tree. */
608 foundp = (struct known_translation_t **)
609 tsearch (newp, &root, transcmp);
610 if (__builtin_expect (&newp != foundp, 0))
611 /* The insert failed. */
617 /* We can update the existing entry. */
618 (*foundp)->counter = _nl_msg_cat_cntr;
619 (*foundp)->translation = retval;
622 __libc_rwlock_unlock (_nl_state_lock);
633 _nl_find_msg (domain_file, msgid, index)
634 struct loaded_l10nfile *domain_file;
636 unsigned long int index;
638 struct loaded_domain *domain;
642 if (domain_file->decided == 0)
643 _nl_load_domain (domain_file);
645 if (domain_file->data == NULL)
648 domain = (struct loaded_domain *) domain_file->data;
650 /* Locate the MSGID and its translation. */
651 if (domain->hash_size > 2 && domain->hash_tab != NULL)
653 /* Use the hashing table. */
654 nls_uint32 len = strlen (msgid);
655 nls_uint32 hash_val = hash_string (msgid);
656 nls_uint32 idx = hash_val % domain->hash_size;
657 nls_uint32 incr = 1 + (hash_val % (domain->hash_size - 2));
658 nls_uint32 nstr = W (domain->must_swap, domain->hash_tab[idx]);
661 /* Hash table entry is empty. */
664 if (W (domain->must_swap, domain->orig_tab[nstr - 1].length) == len
666 domain->data + W (domain->must_swap,
667 domain->orig_tab[nstr - 1].offset)) == 0)
675 if (idx >= domain->hash_size - incr)
676 idx -= domain->hash_size - incr;
680 nstr = W (domain->must_swap, domain->hash_tab[idx]);
682 /* Hash table entry is empty. */
685 if (W (domain->must_swap, domain->orig_tab[nstr - 1].length) == len
687 domain->data + W (domain->must_swap,
688 domain->orig_tab[nstr - 1].offset))
699 /* Try the default method: binary search in the sorted array of
704 top = domain->nstrings;
709 act = (bottom + top) / 2;
710 cmp_val = strcmp (msgid, (domain->data
711 + W (domain->must_swap,
712 domain->orig_tab[act].offset)));
715 else if (cmp_val > 0)
720 /* No translation was found. */
725 /* The translation was found at index ACT. If we have to convert the
726 string to use a different character set, this is the time. */
727 result = (char *) domain->data
728 + W (domain->must_swap, domain->trans_tab[act].offset);
730 #if defined _LIBC || HAVE_ICONV
733 domain->conv != (__gconv_t) -1
736 domain->conv != (iconv_t) -1
741 /* We are supposed to do a conversion. First allocate an
742 appropriate table with the same structure as the table
743 of translations in the file, where we can put the pointers
744 to the converted strings in.
745 The is a slight complication with the INDEX: We don't know
746 a priori which entries are plural entries. Therefore at any
747 moment we can only translate the variants 0 .. INDEX. */
749 if (domain->conv_tab == NULL
750 && ((domain->conv_tab = (char **) calloc (domain->nstrings,
753 /* Mark that we didn't succeed allocating a table. */
754 domain->conv_tab = (char **) -1;
756 if (__builtin_expect (domain->conv_tab == (char **) -1, 0))
757 /* Nothing we can do, no more memory. */
760 if (domain->conv_tab[act] == NULL
761 || *(nls_uint32 *) domain->conv_tab[act] < index)
763 /* We haven't used this string so far, so it is not
764 translated yet. Do this now. */
765 /* We use a bit more efficient memory handling.
766 We allocate always larger blocks which get used over
767 time. This is faster than many small allocations. */
768 __libc_lock_define_initialized (static, lock)
769 static unsigned char *freemem;
770 static size_t freemem_size;
773 const unsigned char *inbuf;
774 unsigned char *outbuf;
776 /* Note that we translate (index + 1) consecutive strings at
777 once, including the final NUL byte. */
779 unsigned long int i = index;
784 resultlen = p - result;
788 outbuf = freemem + 4;
790 __libc_lock_lock (lock);
795 size_t non_reversible;
798 res = __gconv (domain->conv,
799 &inbuf, inbuf + resultlen,
800 &outbuf, outbuf + freemem_size,
803 if (res == __GCONV_OK || res == __GCONV_EMPTY_INPUT)
806 if (res != __GCONV_FULL_OUTPUT)
808 __libc_lock_unlock (lock);
815 const char *inptr = (const char *) inbuf;
816 size_t inleft = resultlen;
817 char *outptr = (char *) outbuf;
818 size_t outleft = freemem_size;
820 if (iconv (domain->conv, &inptr, &inleft, &outptr, &outleft)
823 outbuf = (unsigned char *) outptr;
828 __libc_lock_unlock (lock);
834 /* We must resize the buffer. */
835 freemem_size = 2 * freemem_size;
836 if (freemem_size < 4064)
838 freemem = (char *) malloc (freemem_size);
839 if (__builtin_expect (freemem == NULL, 0))
841 __libc_lock_unlock (lock);
845 outbuf = freemem + 4;
848 /* We have now in our buffer a converted string. Put this
849 into the table of conversions. */
850 *(nls_uint32 *) freemem = index;
851 domain->conv_tab[act] = freemem;
852 /* Shrink freemem, but keep it aligned. */
853 freemem_size -= outbuf - freemem;
855 freemem += freemem_size & (__alignof__ (nls_uint32) - 1);
856 freemem_size = freemem_size & ~ (__alignof__ (nls_uint32) - 1);
858 __libc_lock_unlock (lock);
861 /* Now domain->conv_tab[act] contains the translation of at least
862 the variants 0 .. INDEX. */
863 result = domain->conv_tab[act] + 4;
867 /* The result string is converted. */
869 #endif /* _LIBC || HAVE_ICONV */
871 /* Now skip some strings. How much depends on the index passed in. */
875 result = __rawmemchr (result, '\0');
877 result = strchr (result, '\0');
879 /* And skip over the NUL byte. */
887 /* Function to evaluate the plural expression and return an index value. */
888 static unsigned long int
890 plural_eval (struct expression *pexp, unsigned long int n)
892 switch (pexp->operation)
897 return pexp->val.num;
899 return (plural_eval (pexp->val.args2.left, n)
900 * plural_eval (pexp->val.args2.right, n));
902 return (plural_eval (pexp->val.args2.left, n)
903 / plural_eval (pexp->val.args2.right, n));
905 return (plural_eval (pexp->val.args2.left, n)
906 % plural_eval (pexp->val.args2.right, n));
908 return (plural_eval (pexp->val.args2.left, n)
909 + plural_eval (pexp->val.args2.right, n));
911 return (plural_eval (pexp->val.args2.left, n)
912 - plural_eval (pexp->val.args2.right, n));
914 return (plural_eval (pexp->val.args2.left, n)
915 == plural_eval (pexp->val.args2.right, n));
917 return (plural_eval (pexp->val.args2.left, n)
918 != plural_eval (pexp->val.args2.right, n));
920 return (plural_eval (pexp->val.args2.left, n)
921 && plural_eval (pexp->val.args2.right, n));
923 return (plural_eval (pexp->val.args2.left, n)
924 || plural_eval (pexp->val.args2.right, n));
926 return (plural_eval (pexp->val.args3.bexp, n)
927 ? plural_eval (pexp->val.args3.tbranch, n)
928 : plural_eval (pexp->val.args3.fbranch, n));
935 /* Return string representation of locale CATEGORY. */
938 category_to_name (category)
947 retval = "LC_COLLATE";
957 retval = "LC_MONETARY";
962 retval = "LC_NUMERIC";
972 retval = "LC_MESSAGES";
977 retval = "LC_RESPONSE";
982 /* This might not make sense but is perhaps better than any other
988 /* If you have a better idea for a default value let me know. */
995 /* Guess value of current locale from value of the environment variables. */
998 guess_category_value (category, categoryname)
1000 const char *categoryname;
1004 /* The highest priority value is the `LANGUAGE' environment
1005 variable. This is a GNU extension. */
1006 retval = getenv ("LANGUAGE");
1007 if (retval != NULL && retval[0] != '\0')
1010 /* `LANGUAGE' is not set. So we have to proceed with the POSIX
1011 methods of looking to `LC_ALL', `LC_xxx', and `LANG'. On some
1012 systems this can be done by the `setlocale' function itself. */
1013 #if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL
1014 return setlocale (category, NULL);
1016 /* Setting of LC_ALL overwrites all other. */
1017 retval = getenv ("LC_ALL");
1018 if (retval != NULL && retval[0] != '\0')
1021 /* Next comes the name of the desired category. */
1022 retval = getenv (categoryname);
1023 if (retval != NULL && retval[0] != '\0')
1026 /* Last possibility is the LANG environment variable. */
1027 retval = getenv ("LANG");
1028 if (retval != NULL && retval[0] != '\0')
1031 /* We use C as the default domain. POSIX says this is implementation
1037 /* @@ begin of epilog @@ */
1039 /* We don't want libintl.a to depend on any other library. So we
1040 avoid the non-standard function stpcpy. In GNU C Library this
1041 function is available, though. Also allow the symbol HAVE_STPCPY
1043 #if !_LIBC && !HAVE_STPCPY
1049 while ((*dest++ = *src++) != '\0')
1055 #if !_LIBC && !HAVE_MEMPCPY
1057 mempcpy (dest, src, n)
1062 return (void *) ((char *) memcpy (dst, src, n) + n);
1068 /* If we want to free all resources we have to do some work at
1070 static void __attribute__ ((unused))
1073 struct binding *runp;
1075 for (runp = _nl_domain_bindings; runp != NULL; runp = runp->next)
1077 if (runp->dirname != _nl_default_dirname)
1078 /* Yes, this is a pointer comparison. */
1079 free (runp->dirname);
1080 if (runp->codeset != NULL)
1081 free (runp->codeset);
1084 if (_nl_current_default_domain != _nl_default_default_domain)
1085 /* Yes, again a pointer comparison. */
1086 free ((char *) _nl_current_default_domain);
1088 /* Remove the search tree with the known translations. */
1089 __tdestroy (root, free);
1092 text_set_element (__libc_subfreeres, free_mem);