+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'.
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
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
# 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
# define locale_encoding_classification_uncached locale_encoding_classification
# endif
-# if GNULIB_WCHAR_SINGLE
+# if GNULIB_WCHAR_SINGLE_LOCALE
static inline
# endif
enc_t
return enc_other;
}
-# if GNULIB_WCHAR_SINGLE
+# if GNULIB_WCHAR_SINGLE_LOCALE
static int cached_locale_enc = -1;
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;
{
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++)