From: Bruno Haible Date: Tue, 24 Dec 2019 16:37:22 +0000 (+0100) Subject: Update after gnulib changed: Support building with --enable-threads=isoc. X-Git-Tag: v0.20.2~82 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d8b66817b8b739b2bf485a2db02feebbdb2ef6f6;p=thirdparty%2Fgettext.git Update after gnulib changed: Support building with --enable-threads=isoc. * gettext-runtime/intl/dcigettext.c (lock): Move outside _nl_find_msg. * gettext-runtime/intl/finddomain.c (lock): Move outside _nl_find_domain. * gettext-runtime/intl/loadmsgcat.c (lock): Move outside _nl_load_domain. --- diff --git a/gettext-runtime/intl/dcigettext.c b/gettext-runtime/intl/dcigettext.c index ba333303f..f73f8dbe1 100644 --- a/gettext-runtime/intl/dcigettext.c +++ b/gettext-runtime/intl/dcigettext.c @@ -875,6 +875,13 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, } +/* This lock primarily protects the memory management variables freemem, + freemem_size. It also protects write accesses to convd->conv_tab. + It's not worth using a separate lock (such as domain->conversions_lock) + for this purpose, because when modifying convd->conv_tab, we also need + to lock freemem, freemem_size for most of the time. */ +__libc_lock_define_initialized (static, lock) + /* Look up the translation of msgid within DOMAIN_FILE and DOMAINBINDING. Return it if found. Return NULL if not found or in case of a conversion failure (problem in the particular message catalog). Return (char *) -1 @@ -1221,14 +1228,6 @@ _nl_find_msg (struct loaded_l10nfile *domain_file, handle this case by converting RESULTLEN bytes, including NULs. */ - /* This lock primarily protects the memory management variables - freemem, freemem_size. It also protects write accesses to - convd->conv_tab. It's not worth using a separate lock (such - as domain->conversions_lock) for this purpose, because when - modifying convd->conv_tab, we also need to lock freemem, - freemem_size for most of the time. */ - __libc_lock_define_initialized (static, lock) - if (__builtin_expect (convd->conv_tab == NULL, 0)) { __libc_lock_lock (lock); diff --git a/gettext-runtime/intl/finddomain.c b/gettext-runtime/intl/finddomain.c index 142b18e0e..408a47ea0 100644 --- a/gettext-runtime/intl/finddomain.c +++ b/gettext-runtime/intl/finddomain.c @@ -1,5 +1,5 @@ /* Handle list of needed message catalogs - Copyright (C) 1995-2016 Free Software Foundation, Inc. + Copyright (C) 1995-2019 Free Software Foundation, Inc. Written by Ulrich Drepper , 1995. This program is free software: you can redistribute it and/or modify @@ -50,6 +50,9 @@ /* List of already loaded domains. */ static struct loaded_l10nfile *_nl_loaded_domains; +/* Lock that protects the access to _NL_LOADED_DOMAINS. */ +gl_rwlock_define_initialized (static, lock); + /* Return a data structure describing the message catalog described by the DOMAINNAME and CATEGORY parameters with respect to the currently @@ -83,7 +86,6 @@ _nl_find_domain (const char *dirname, char *locale, */ /* We need to protect modifying the _NL_LOADED_DOMAINS data. */ - gl_rwlock_define_initialized (static, lock); gl_rwlock_rdlock (lock); /* If we have already tested for this locale entry there has to diff --git a/gettext-runtime/intl/loadmsgcat.c b/gettext-runtime/intl/loadmsgcat.c index 363001066..ea514c101 100644 --- a/gettext-runtime/intl/loadmsgcat.c +++ b/gettext-runtime/intl/loadmsgcat.c @@ -1,5 +1,5 @@ /* Load needed message catalogs. - Copyright (C) 1995-2017 Free Software Foundation, Inc. + Copyright (C) 1995-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -786,6 +786,9 @@ get_sysdep_segment_value (const char *name) return NULL; } +/* Lock that protects the various 'struct loaded_l10nfile' objects. */ +__libc_lock_define_initialized_recursive (static, lock); + /* Load the message catalogs specified by FILENAME. If it is no valid message catalog do nothing. */ void @@ -806,7 +809,6 @@ _nl_load_domain (struct loaded_l10nfile *domain_file, int revision; const char *nullentry; size_t nullentrylen; - __libc_lock_define_initialized_recursive (static, lock); __libc_lock_lock_recursive (lock); if (domain_file->decided != 0)