]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Update after gnulib changed: Support building with --enable-threads=isoc.
authorBruno Haible <bruno@clisp.org>
Tue, 24 Dec 2019 16:37:22 +0000 (17:37 +0100)
committerBruno Haible <bruno@clisp.org>
Mon, 13 Apr 2020 08:12:26 +0000 (10:12 +0200)
* 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.

gettext-runtime/intl/dcigettext.c
gettext-runtime/intl/finddomain.c
gettext-runtime/intl/loadmsgcat.c

index ba333303f194797cc900d7da7de3b97136a415ff..f73f8dbe16b91ccc132fecd02fc4d3f3052a0aa0 100644 (file)
@@ -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);
index 142b18e0ef84386c448ba927ab261f2f8ea0ed7c..408a47ea03dfa2e83d02975a14525989853ec191 100644 (file)
@@ -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 <drepper@gnu.org>, 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
index 363001066115f5aff6ff83c21c83e5222aaa1a27..ea514c101b300dd6668b7f13e46139558ba06a3e 100644 (file)
@@ -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)