]> Savannah Git Hosting - gnulib.git/commitdiff
Rename GNULIB_WCHAR_SINGLE to GNULIB_WCHAR_SINGLE_LOCALE.
authorBruno Haible <bruno@clisp.org>
Sun, 7 Mar 2021 09:45:58 +0000 (10:45 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 7 Mar 2021 10:02:00 +0000 (11:02 +0100)
* lib/lc-charset-dispatch.c: Test GNULIB_WCHAR_SINGLE_LOCALE instead of
GNULIB_WCHAR_SINGLE.
* lib/wcwidth.c: Likewise.
* tests/test-wcwidth.c: Likewise.
* doc/multithread.texi: Document GNULIB_WCHAR_SINGLE_LOCALE instead of
GNULIB_WCHAR_SINGLE.
* NEWS: Document the change.

ChangeLog
NEWS
doc/multithread.texi
lib/lc-charset-dispatch.c
lib/wcwidth.c
tests/test-wcwidth.c

index 80590b1f0301a32090e76cdef626c1696e9f2054..8b5ed00d6d4675371a9a8e2f6faf452b7476ced2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2021-03-07  Bruno Haible  <bruno@clisp.org>
+
+       Rename GNULIB_WCHAR_SINGLE to GNULIB_WCHAR_SINGLE_LOCALE.
+       * lib/lc-charset-dispatch.c: Test GNULIB_WCHAR_SINGLE_LOCALE instead of
+       GNULIB_WCHAR_SINGLE.
+       * lib/wcwidth.c: Likewise.
+       * tests/test-wcwidth.c: Likewise.
+       * doc/multithread.texi: Document GNULIB_WCHAR_SINGLE_LOCALE instead of
+       GNULIB_WCHAR_SINGLE.
+       * NEWS: Document the change.
+
 2021-03-06  Bruno Haible  <bruno@clisp.org>
 
        mbrtowc: Allow locking optimization independently of 'unlocked-io'.
diff --git a/NEWS b/NEWS
index 318055ae8aaf37e75c8184ba080272d9310b7495..ba8988198b60ba09bf0f9133a83c83dfa1a93c56 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -60,6 +60,10 @@ User visible incompatible changes
 
 Date        Modules         Changes
 
+2021-03-07  mbrtowc         For single-locale optimizations, you now need to
+            mbrtoc32        define GNULIB_WCHAR_SINGLE_LOCALE instead of
+            wcwidth         GNULIB_WCHAR_SINGLE.
+
 2021-02-28  parse-datetime  The parse_datetime2 function has been moved
                             to the new parse-datetime2 module, so that
                             programs that need just parse_datetime need
index b28d1de73c9b19a06526ef4e360cb98f4fa98b6c..eef724d2aef4c43503091c4bc0d6424afb5728a0 100644 (file)
@@ -279,9 +279,16 @@ programs in your package invoke the functions @code{mbrtowc}, @code{mbrtoc32},
 and the functions of the @code{regex} module only from a single thread.  (The
 @code{regex} module uses @code{mbrtowc} under the hood.)
 @item
-You may define the C macro @code{GNULIB_WCHAR_SINGLE}, if all the programs in
-your package are single-threaded and won't change the locale after it has
-been initialized.  This macro optimizes the functions @code{mbrtowc} and
+You may define the C macro @code{GNULIB_WCHAR_SINGLE_LOCALE}, if all the
+programs in your package set the locale early and
+@itemize
+@item
+don't change the locale after it has been initialized, and
+@item
+don't call locale sensitive functions (@code{mbrtowc}, @code{wcwidth}, etc.@:)
+before the locale has been initialized.
+@end itemize
+This macro optimizes the functions @code{mbrtowc}, @code{mbrtoc32}, and
 @code{wcwidth}.
 @item
 You may define the C macro @code{GNULIB_GETUSERSHELL_SINGLE_THREAD}, if all the
index 879f71ad0123d2262db5c1066ec77fe27dda8541..5c63c4b2568ce9a0d47f10e2699585d9d7d706c3 100644 (file)
@@ -26,7 +26,7 @@
 # include "localcharset.h"
 # include "streq.h"
 
-# if GNULIB_WCHAR_SINGLE
+# if GNULIB_WCHAR_SINGLE_LOCALE
 /* When we know that the locale does not change, provide a speedup by
    caching the value of locale_encoding_classification.  */
 #  define locale_encoding_classification_cached locale_encoding_classification
@@ -35,7 +35,7 @@
 #  define locale_encoding_classification_uncached locale_encoding_classification
 # endif
 
-# if GNULIB_WCHAR_SINGLE
+# if GNULIB_WCHAR_SINGLE_LOCALE
 static inline
 # endif
 enc_t
@@ -59,7 +59,7 @@ locale_encoding_classification_uncached (void)
   return enc_other;
 }
 
-# if GNULIB_WCHAR_SINGLE
+# if GNULIB_WCHAR_SINGLE_LOCALE
 
 static int cached_locale_enc = -1;
 
index 9009ebc7d5b13eccb98d17369f0c790705ea2889..8d850823895c16892fc7de34a9fdc53afc43dbc0 100644 (file)
@@ -34,7 +34,7 @@ is_locale_utf8 (void)
   return STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0);
 }
 
-#if GNULIB_WCHAR_SINGLE
+#if GNULIB_WCHAR_SINGLE_LOCALE
 /* When we know that the locale does not change, provide a speedup by
    caching the value of is_locale_utf8.  */
 static int cached_is_locale_utf8 = -1;
index 16c68374b19884178fdc2e7301f460b4c0eb2850..e5e3a54bf14f601d4f8821ec8c1c04d5a7083c40 100644 (file)
@@ -35,7 +35,7 @@ main ()
 {
   wchar_t wc;
 
-#if !GNULIB_WCHAR_SINGLE
+#if !GNULIB_WCHAR_SINGLE_LOCALE
 # ifdef C_CTYPE_ASCII
   /* Test width of ASCII characters.  */
   for (wc = 0x20; wc < 0x7F; wc++)