From: Bruno Haible Date: Mon, 19 Jun 2006 10:48:52 +0000 (+0000) Subject: Don't use __libc_* symbols on non-glibc platforms. X-Git-Tag: v0.15~94 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3e90f10021d4576ec33cc7c8e795f6dd440ce23;p=thirdparty%2Fgettext.git Don't use __libc_* symbols on non-glibc platforms. --- diff --git a/gettext-runtime/intl/ChangeLog b/gettext-runtime/intl/ChangeLog index fb33c4273..aaa86ad8b 100644 --- a/gettext-runtime/intl/ChangeLog +++ b/gettext-runtime/intl/ChangeLog @@ -1,3 +1,23 @@ +2006-06-17 Bruno Haible + + * bindtextdom.c (gl_rwlock_define, gl_rwlock_wrlock, gl_rwlock_unlock) + [_LIBC]: New macros. + (_nl_state_lock, set_binding_values): Use gl_rwlock_* instead of + __libc_rwlock_*. + * dcigettext.c (gl_rwlock_define_initialized, gl_rwlock_rdlock, + gl_rwlock_wrlock, gl_rwlock_unlock) [_LIBC]: New macros. + (tree_lock, _nl_state_lock, DCIGETTEXT): Use gl_rwlock_* instead of + __libc_rwlock_*. + * finddomain.c (gl_rwlock_define_initialized, gl_rwlock_rdlock, + gl_rwlock_wrlock, gl_rwlock_unlock) [_LIBC]: New macros. + (_nl_find_domain): Use gl_rwlock_* instead of __libc_rwlock_*. + * textdomain.c (gl_rwlock_define, gl_rwlock_wrlock, gl_rwlock_unlock) + [_LIBC]: New macros. + (_nl_state_lock, TEXTDOMAIN): Use gl_rwlock_* instead of + __libc_rwlock_*. + Needed because NetBSD 3.0 does + #define pthread_rwlock_rdlock __libc_rwlock_rdlock etc. + 2006-06-17 Bruno Haible * config.charset: Update for NetBSD 3.0. diff --git a/gettext-runtime/intl/bindtextdom.c b/gettext-runtime/intl/bindtextdom.c index 405bdad66..d1b1f9028 100644 --- a/gettext-runtime/intl/bindtextdom.c +++ b/gettext-runtime/intl/bindtextdom.c @@ -1,5 +1,5 @@ /* Implementation of the bindtextdomain(3) function - Copyright (C) 1995-1998, 2000-2003, 2005 Free Software Foundation, Inc. + Copyright (C) 1995-1998, 2000-2003, 2005-2006 Free Software Foundation, Inc. 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 @@ -34,6 +34,9 @@ /* Handle multi-threaded applications. */ #ifdef _LIBC # include +# define gl_rwlock_define __libc_rwlock_define +# define gl_rwlock_wrlock __libc_rwlock_wrlock +# define gl_rwlock_unlock __libc_rwlock_unlock #else # include "lock.h" #endif @@ -63,7 +66,7 @@ libc_hidden_proto (_nl_default_dirname) extern struct binding *_nl_domain_bindings; /* Lock variable to protect the global data in the gettext implementation. */ -__libc_rwlock_define (extern, _nl_state_lock attribute_hidden) +gl_rwlock_define (extern, _nl_state_lock attribute_hidden) /* Names for the libintl functions are a problem. They must not clash @@ -104,7 +107,7 @@ set_binding_values (const char *domainname, return; } - __libc_rwlock_wrlock (_nl_state_lock); + gl_rwlock_wrlock (_nl_state_lock); modified = 0; @@ -326,7 +329,7 @@ set_binding_values (const char *domainname, if (modified) ++_nl_msg_cat_cntr; - __libc_rwlock_unlock (_nl_state_lock); + gl_rwlock_unlock (_nl_state_lock); } /* Specify that the DOMAINNAME message catalog will be found diff --git a/gettext-runtime/intl/dcigettext.c b/gettext-runtime/intl/dcigettext.c index 861c49cd4..456ff7f25 100644 --- a/gettext-runtime/intl/dcigettext.c +++ b/gettext-runtime/intl/dcigettext.c @@ -106,6 +106,10 @@ extern int errno; /* Handle multi-threaded applications. */ #ifdef _LIBC # include +# define gl_rwlock_define_initialized __libc_rwlock_define_initialized +# define gl_rwlock_rdlock __libc_rwlock_rdlock +# define gl_rwlock_wrlock __libc_rwlock_wrlock +# define gl_rwlock_unlock __libc_rwlock_unlock #else # include "lock.h" #endif @@ -261,7 +265,7 @@ struct known_translation_t #if defined HAVE_TSEARCH || defined _LIBC # include -__libc_rwlock_define_initialized (static, tree_lock) +gl_rwlock_define_initialized (static, tree_lock) static void *root; @@ -430,7 +434,7 @@ typedef unsigned char transmem_block_t; #endif /* Lock variable to protect the global data in the gettext implementation. */ -__libc_rwlock_define_initialized (, _nl_state_lock attribute_hidden) +gl_rwlock_define_initialized (, _nl_state_lock attribute_hidden) /* Checking whether the binaries runs SUID must be done and glibc provides easier methods therefore we make a difference here. */ @@ -517,7 +521,7 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, : n == 1 ? (char *) msgid1 : (char *) msgid2); #endif - __libc_rwlock_rdlock (_nl_state_lock); + gl_rwlock_rdlock (_nl_state_lock); /* If DOMAINNAME is NULL, we are interested in the default domain. If CATEGORY is not LC_MESSAGES this might not make much sense but the @@ -572,11 +576,11 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, /* Since tfind/tsearch manage a balanced tree, concurrent tfind and tsearch calls can be fatal. */ - __libc_rwlock_rdlock (tree_lock); + gl_rwlock_rdlock (tree_lock); foundp = (struct known_translation_t **) tfind (search, &root, transcmp); - __libc_rwlock_unlock (tree_lock); + gl_rwlock_unlock (tree_lock); freea (search); if (foundp != NULL && (*foundp)->counter == _nl_msg_cat_cntr) @@ -588,7 +592,7 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, else retval = (char *) (*foundp)->translation; - __libc_rwlock_unlock (_nl_state_lock); + gl_rwlock_unlock (_nl_state_lock); return retval; } #endif @@ -799,13 +803,13 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, newp->translation = retval; newp->translation_length = retlen; - __libc_rwlock_wrlock (tree_lock); + gl_rwlock_wrlock (tree_lock); /* Insert the entry in the search tree. */ foundp = (struct known_translation_t **) tsearch (newp, &root, transcmp); - __libc_rwlock_unlock (tree_lock); + gl_rwlock_unlock (tree_lock); if (foundp == NULL || __builtin_expect (*foundp != newp, 0)) @@ -828,7 +832,7 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, if (plural) retval = plural_lookup (domain, n, retval, retlen); - __libc_rwlock_unlock (_nl_state_lock); + gl_rwlock_unlock (_nl_state_lock); return retval; } } @@ -837,7 +841,7 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, return_untranslated: /* Return the untranslated MSGID. */ FREE_BLOCKS (block_list); - __libc_rwlock_unlock (_nl_state_lock); + gl_rwlock_unlock (_nl_state_lock); #ifndef _LIBC if (!ENABLE_SECURE) { diff --git a/gettext-runtime/intl/finddomain.c b/gettext-runtime/intl/finddomain.c index 9501d6941..a25bebcb9 100644 --- a/gettext-runtime/intl/finddomain.c +++ b/gettext-runtime/intl/finddomain.c @@ -40,6 +40,10 @@ /* Handle multi-threaded applications. */ #ifdef _LIBC # include +# define gl_rwlock_define_initialized __libc_rwlock_define_initialized +# define gl_rwlock_rdlock __libc_rwlock_rdlock +# define gl_rwlock_wrlock __libc_rwlock_wrlock +# define gl_rwlock_unlock __libc_rwlock_unlock #else # include "lock.h" #endif @@ -81,8 +85,8 @@ _nl_find_domain (const char *dirname, char *locale, */ /* We need to protect modifying the _NL_LOADED_DOMAINS data. */ - __libc_rwlock_define_initialized (static, lock); - __libc_rwlock_rdlock (lock); + gl_rwlock_define_initialized (static, lock); + gl_rwlock_rdlock (lock); /* If we have already tested for this locale entry there has to be one data set in the list of loaded domains. */ @@ -90,7 +94,7 @@ _nl_find_domain (const char *dirname, char *locale, strlen (dirname) + 1, 0, locale, NULL, NULL, NULL, NULL, domainname, 0); - __libc_rwlock_unlock (lock); + gl_rwlock_unlock (lock); if (retval != NULL) { @@ -142,7 +146,7 @@ _nl_find_domain (const char *dirname, char *locale, &codeset, &normalized_codeset); /* We need to protect modifying the _NL_LOADED_DOMAINS data. */ - __libc_rwlock_wrlock (lock); + gl_rwlock_wrlock (lock); /* Create all possible locale entries which might be interested in generalization. */ @@ -151,7 +155,7 @@ _nl_find_domain (const char *dirname, char *locale, codeset, normalized_codeset, modifier, domainname, 1); - __libc_rwlock_unlock (lock); + gl_rwlock_unlock (lock); if (retval == NULL) /* This means we are out of core. */ diff --git a/gettext-runtime/intl/textdomain.c b/gettext-runtime/intl/textdomain.c index 23e91c874..c316460fd 100644 --- a/gettext-runtime/intl/textdomain.c +++ b/gettext-runtime/intl/textdomain.c @@ -1,5 +1,5 @@ /* Implementation of the textdomain(3) function. - Copyright (C) 1995-1998, 2000-2003, 2005 Free Software Foundation, Inc. + Copyright (C) 1995-1998, 2000-2003, 2005-2006 Free Software Foundation, Inc. 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 @@ -33,6 +33,9 @@ /* Handle multi-threaded applications. */ #ifdef _LIBC # include +# define gl_rwlock_define __libc_rwlock_define +# define gl_rwlock_wrlock __libc_rwlock_wrlock +# define gl_rwlock_unlock __libc_rwlock_unlock #else # include "lock.h" #endif @@ -68,7 +71,7 @@ extern const char *_nl_current_default_domain attribute_hidden; #endif /* Lock variable to protect the global data in the gettext implementation. */ -__libc_rwlock_define (extern, _nl_state_lock attribute_hidden) +gl_rwlock_define (extern, _nl_state_lock attribute_hidden) /* Set the current default message catalog to DOMAINNAME. If DOMAINNAME is null, return the current default. @@ -83,7 +86,7 @@ TEXTDOMAIN (const char *domainname) if (domainname == NULL) return (char *) _nl_current_default_domain; - __libc_rwlock_wrlock (_nl_state_lock); + gl_rwlock_wrlock (_nl_state_lock); old_domain = (char *) _nl_current_default_domain; @@ -127,7 +130,7 @@ TEXTDOMAIN (const char *domainname) free (old_domain); } - __libc_rwlock_unlock (_nl_state_lock); + gl_rwlock_unlock (_nl_state_lock); return new_domain; } diff --git a/gettext-runtime/m4/ChangeLog b/gettext-runtime/m4/ChangeLog index f2cf990f5..dbfb69693 100644 --- a/gettext-runtime/m4/ChangeLog +++ b/gettext-runtime/m4/ChangeLog @@ -1,3 +1,7 @@ +2006-06-17 Bruno Haible + + * gettext.m4 (AM_INTL_SUBDIR): Don't redefine __libc_rwlock_* symbols. + 2006-06-17 Bruno Haible * po.m4 (AM_POSTPROCESS_PO_MAKEFILE): Remove double-quotes around diff --git a/gettext-runtime/m4/gettext.m4 b/gettext-runtime/m4/gettext.m4 index 0048586ad..5f834100e 100644 --- a/gettext-runtime/m4/gettext.m4 +++ b/gettext-runtime/m4/gettext.m4 @@ -1,4 +1,4 @@ -# gettext.m4 serial 50 (gettext-0.15) +# gettext.m4 serial 51 (gettext-0.15) dnl Copyright (C) 1995-2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -445,13 +445,6 @@ AC_DEFUN([AM_INTL_SUBDIR], #define __libc_lock_init gl_lock_init #define __libc_lock_lock gl_lock_lock #define __libc_lock_unlock gl_lock_unlock -#define __libc_rwlock_t gl_rwlock_t -#define __libc_rwlock_define gl_rwlock_define -#define __libc_rwlock_define_initialized gl_rwlock_define_initialized -#define __libc_rwlock_init gl_rwlock_init -#define __libc_rwlock_rdlock gl_rwlock_rdlock -#define __libc_rwlock_wrlock gl_rwlock_wrlock -#define __libc_rwlock_unlock gl_rwlock_unlock #define __libc_lock_recursive_t gl_recursive_lock_t #define __libc_lock_define_recursive gl_recursive_lock_define #define __libc_lock_define_initialized_recursive gl_recursive_lock_define_initialized