]> Savannah Git Hosting - gnulib.git/log
gnulib.git
21 months agoDocument migration path for obsolescent functions.
Bruno Haible [Wed, 19 Jul 2023 23:35:10 +0000 (01:35 +0200)]
Document migration path for obsolescent functions.

* doc/glibc-functions/timespec_get.texi: Add reference to ISO C.
* doc/posix-functions/_tolower.texi: Recommend use of tolower.
* doc/posix-functions/_toupper.texi: Recommend use of toupper.
* doc/posix-functions/asctime.texi: Recommend use of strftime.
* doc/posix-functions/asctime_r.texi: Likewise.
* doc/posix-functions/ctime.texi: Recommend use of localtime_r and
strftime.
* doc/posix-functions/ctime_r.texi: Likewise.
* doc/posix-functions/ftw.texi: Recommend use of fts.
* doc/posix-functions/getitimer.texi: Recommend use of timer_gettime.
* doc/posix-functions/gets.texi: Recommend use of fgets.
* doc/posix-functions/gettimeofday.texi: Recommend use of gettime or
timespec_get.
* doc/posix-functions/inet_addr.texi: Recommend use of inet_pton.
* doc/posix-functions/inet_ntoa.texi: Recommend use of inet_ntop.
* doc/posix-functions/pthread_getconcurrency.texi: Recommend no-op.
* doc/posix-functions/pthread_setconcurrency.texi: Recommend no-op.
* doc/posix-functions/rand_r.texi: Recommend use of random_r.
* doc/posix-functions/setitimer.texi: Recommend use of timer_create and
timer_settime.
* doc/posix-functions/setpgrp.texi: Recommend use of setpgid or setsid.
* doc/posix-functions/sighold.texi: Recommend use of sigprocmask.
* doc/posix-functions/sigignore.texi: Recommend use of sigaction.
* doc/posix-functions/siginterrupt.texi: Recommend use of sigaction.
* doc/posix-functions/sigpause.texi: Recommend use of sigsuspend.
* doc/posix-functions/sigrelse.texi: Recommend use of sigprocmask.
* doc/posix-functions/sigset.texi: Recommend use of sigaction.
* doc/posix-functions/tempnam.texi: Recommend use of mkstemp.
* doc/posix-functions/ulimit.texi: Recommend use of getrlimit and
setrlimit.
* doc/posix-functions/utime.texi: Recommend use of utimens.

21 months agoDocument POSIX obsolescence
Paul Eggert [Wed, 19 Jul 2023 20:51:55 +0000 (13:51 -0700)]
Document POSIX obsolescence

* doc/posix-functions/_longjmp.texi, doc/posix-functions/_setjmp.texi:
* doc/posix-functions/_tolower.texi, doc/posix-functions/_toupper.texi:
* doc/posix-functions/asctime.texi, doc/posix-functions/asctime_r.texi:
* doc/posix-functions/ctime.texi, doc/posix-functions/ctime_r.texi:
* doc/posix-functions/encrypt.texi, doc/posix-functions/ftw.texi:
* doc/posix-functions/getitimer.texi, doc/posix-functions/gets.texi:
* doc/posix-functions/gettimeofday.texi:
* doc/posix-functions/inet_addr.texi:
* doc/posix-functions/inet_ntoa.texi, doc/posix-functions/isascii.texi:
* doc/posix-functions/pthread_getconcurrency.texi:
* doc/posix-functions/pthread_setconcurrency.texi:
* doc/posix-functions/rand_r.texi, doc/posix-functions/setitimer.texi:
* doc/posix-functions/setkey.texi, doc/posix-functions/setpgrp.texi:
* doc/posix-functions/sighold.texi, doc/posix-functions/sigignore.texi:
* doc/posix-functions/siginterrupt.texi:
* doc/posix-functions/sigpause.texi, doc/posix-functions/sigrelse.texi:
* doc/posix-functions/sigset.texi, doc/posix-functions/tempnam.texi:
* doc/posix-functions/toascii.texi, doc/posix-functions/ulimit.texi:
* doc/posix-functions/utime.texi:
Update as per draft 3 of POSIX 10003.1-202x.

21 months agoDon’t worry about Version 7 tolower
Paul Eggert [Wed, 19 Jul 2023 20:51:55 +0000 (13:51 -0700)]
Don’t worry about Version 7 tolower

Some code ported back to pre-C89 libraries where tolower (C) had
undefined behavior if C is not an upper case character.
Nowadays that function is _tolower which is itself obsolete,
and much Gnulib code already assumes this part of C89 anyway.
Assume C89 or better tolower, which simplifies the code
and should improve performance slightly.
* lib/mbmemcasecmp.c, lib/mbmemcasecoll.c, lib/mbscasecmp.c:
* lib/mbscasestr.c, lib/mbsncasecmp.c, lib/mbspcasecmp.c:
* lib/strcasecmp.c, lib/strcasestr.c, lib/strncasecmp.c:
(TOLOWER): Remove.  All uses replaced by tolower.

21 months agoc32swidth, mbszero: Fix file list.
Bruno Haible [Wed, 19 Jul 2023 20:43:50 +0000 (22:43 +0200)]
c32swidth, mbszero: Fix file list.

* modules/c32swidth (Files): Add locale-ja.m4, locale-zh.m4, codeset.m4.
* modules/mbszero (Files): Likewise.

21 months agowcsnrtombs: Fix file list.
Bruno Haible [Wed, 19 Jul 2023 20:25:30 +0000 (22:25 +0200)]
wcsnrtombs: Fix file list.

* modules/wcsnrtombs (Files): Add locale-fr.m4.

21 months agombsnrtowcs: Fix file list.
Bruno Haible [Wed, 19 Jul 2023 20:24:27 +0000 (22:24 +0200)]
mbsnrtowcs: Fix file list.

* modules/mbsnrtowcs (Files): Add locale-fr.m4, codeset.m4.

21 months agombrtoc16: Fix file list.
Bruno Haible [Wed, 19 Jul 2023 20:23:23 +0000 (22:23 +0200)]
mbrtoc16: Fix file list.

* modules/mbrtoc16 (Files): Add locale-zh.m4.

21 months agombrlen: Fix file list.
Bruno Haible [Wed, 19 Jul 2023 20:21:47 +0000 (22:21 +0200)]
mbrlen: Fix file list.

* modules/mbrlen (Files): Add locale-fr.m4, locale-ja.m4, locale-zh.m4,
codeset.m4.

21 months agombiterf, mbuiterf: port to strict C17
Paul Eggert [Wed, 19 Jul 2023 03:33:41 +0000 (20:33 -0700)]
mbiterf, mbuiterf: port to strict C17

I ran into this problem on NetBSD 9.3.
* lib/mbiterf.h (mbiterf_next) [!GNULIB_MBRTOC32_REGULAR]:
* lib/mbuiterf.h (mbuiterf_next) [!GNULIB_MBRTOC32_REGULAR]:
Don’t label a declaration.

21 months agombiter, mbiterf, mbuiter, mbuiterf: Force inlining with clang.
Bruno Haible [Tue, 18 Jul 2023 12:10:33 +0000 (14:10 +0200)]
mbiter, mbiterf, mbuiter, mbuiterf: Force inlining with clang.

* lib/mbiter.h (MBITER_INLINE): Use _GL_ATTRIBUTE_ALWAYS_INLINE.
* lib/mbiterf.h (MBITERF_INLINE): Likewise.
* lib/mbuiter.h (MBUITER_INLINE): Likewise.
* lib/mbuiterf.h (MBUITERF_INLINE): Likewise.

21 months agombsspn: Optimize.
Bruno Haible [Tue, 18 Jul 2023 11:46:29 +0000 (13:46 +0200)]
mbsspn: Optimize.

* lib/mbsspn.c: Include mbuiterf.h instead of mbuiter.h.
(mbsspn): Use mbuif_* macros instead of mbui_* macros.
* modules/mbsspn (Depends-on): Add mbuiterf. Remove mbuiter.

21 months agombscspn: Optimize.
Bruno Haible [Tue, 18 Jul 2023 11:44:39 +0000 (13:44 +0200)]
mbscspn: Optimize.

* lib/mbscspn.c: Include mbuiterf.h instead of mbuiter.h.
(mbscspn): Use mbuif_* macros instead of mbui_* macros.
* modules/mbscspn (Depends-on): Add mbuiterf. Remove mbuiter.

21 months agombspbrk: Optimize.
Bruno Haible [Tue, 18 Jul 2023 11:43:38 +0000 (13:43 +0200)]
mbspbrk: Optimize.

* lib/mbspbrk.c: Include mbuiterf.h instead of mbuiter.h.
(mbspbrk): Use mbuif_* macros instead of mbui_* macros.
* modules/mbspbrk (Depends-on): Add mbuiterf. Remove mbuiter.

21 months agombspcasecmp: Optimize.
Bruno Haible [Tue, 18 Jul 2023 11:40:11 +0000 (13:40 +0200)]
mbspcasecmp: Optimize.

* lib/mbspcasecmp.c: Include mbuiterf.h instead of mbuiter.h.
(mbspcasecmp): Use mbuif_* macros instead of mbui_* macros.
* modules/mbspcasecmp (Depends-on): Add mbuiterf. Remove mbuiter.

21 months agombsncasecmp: Optimize.
Bruno Haible [Tue, 18 Jul 2023 11:36:00 +0000 (13:36 +0200)]
mbsncasecmp: Optimize.

* lib/mbsncasecmp.c: Include mbuiterf.h instead of mbuiter.h.
(mbsncasecmp): Use mbuif_* macros instead of mbui_* macros.
* modules/mbsncasecmp (Depends-on): Add mbuiterf. Remove mbuiter.

21 months agombscasecmp: Optimize.
Bruno Haible [Tue, 18 Jul 2023 11:35:10 +0000 (13:35 +0200)]
mbscasecmp: Optimize.

* lib/mbscasecmp.c: Include mbuiterf.h instead of mbuiter.h.
(mbscasecmp): Use mbuif_* macros instead of mbui_* macros.
* modules/mbscasecmp (Depends-on): Add mbuiterf. Remove mbuiter.

21 months agombssep: Optimize.
Bruno Haible [Tue, 18 Jul 2023 11:33:08 +0000 (13:33 +0200)]
mbssep: Optimize.

* lib/mbssep.c: Include mbuiterf.h instead of mbuiter.h.
(mbssep): Use mbuif_* macros instead of mbui_* macros.
* modules/mbssep (Depends-on): Add mbuiterf. Remove mbuiter.

21 months agombsrchr: Optimize.
Bruno Haible [Tue, 18 Jul 2023 11:30:18 +0000 (13:30 +0200)]
mbsrchr: Optimize.

* lib/mbsrchr.c: Include mbuiterf.h instead of mbuiter.h.
(mbsrchr): Use mbuif_* macros instead of mbui_* macros.
* modules/mbsrchr (Depends-on): Add mbuiterf. Remove mbuiter.

21 months agombschr: Optimize.
Bruno Haible [Tue, 18 Jul 2023 11:29:14 +0000 (13:29 +0200)]
mbschr: Optimize.

* lib/mbschr.c: Include mbuiterf.h instead of mbuiter.h.
(mbschr): Use mbuif_* macros instead of mbui_* macros.
* modules/mbschr (Depends-on): Add mbuiterf. Remove mbuiter.

21 months agombslen: Optimize.
Bruno Haible [Tue, 18 Jul 2023 11:27:44 +0000 (13:27 +0200)]
mbslen: Optimize.

* lib/mbslen.c: Include mbuiterf.h instead of mbuiter.h.
(mbslen): Use mbuif_* macros instead of mbui_* macros.
* modules/mbslen (Depends-on): Add mbuiterf. Remove mbuiter.

21 months agombuiterf: Add a benchmark.
Bruno Haible [Tue, 18 Jul 2023 11:25:43 +0000 (13:25 +0200)]
mbuiterf: Add a benchmark.

* tests/bench-mbuiterf.c: New file, based on tests/bench-mbuiter.c.
* modules/mbuiterf-bench-tests: New file, based on
modules/mbuiter-bench-tests.

21 months agombuiterf: New module.
Bruno Haible [Tue, 18 Jul 2023 11:24:35 +0000 (13:24 +0200)]
mbuiterf: New module.

* lib/mbuiterf.h: New file, based on lib/mbuiter.h.
* lib/mbuiterf.c: New file, based on lib/mbuiter.c.
* modules/mbuiterf: New file, based on modules/mbuiter.

21 months agombiterf: Fix compiler warnings.
Bruno Haible [Tue, 18 Jul 2023 11:04:04 +0000 (13:04 +0200)]
mbiterf: Fix compiler warnings.

* lib/mbiterf.h (mbiterf_next): Use C99 designated initializer syntax.
* tests/bench-mbiterf.c (do_test): Use a 'const char *' pointer.

21 months agotrim: Optimize.
Bruno Haible [Tue, 18 Jul 2023 10:23:12 +0000 (12:23 +0200)]
trim: Optimize.

* lib/trim.c: Include mbiterf.h instead of mbiter.h.
(trim2): Use mbif_* macros instead of mbi_* macros.
* modules/trim (Depends-on): Add mbiterf. Remove mbiter.

21 months agombmemcasecmp: Optimize.
Bruno Haible [Tue, 18 Jul 2023 10:21:46 +0000 (12:21 +0200)]
mbmemcasecmp: Optimize.

* lib/mbmemcasecmp.c: Include mbiterf.h instead of mbiter.h.
(mbmemcasecmp): Use mbif_* macros instead of mbi_* macros.
* modules/mbmemcasecmp (Depends-on): Add mbiterf. Remove mbiter.

21 months agombsnlen: Optimize.
Bruno Haible [Tue, 18 Jul 2023 10:19:58 +0000 (12:19 +0200)]
mbsnlen: Optimize.

* lib/mbsnlen.c: Include mbiterf.h instead of mbiter.h.
(mbsnlen): Use mbif_* macros instead of mbi_* macros.
* modules/mbsnlen (Depends-on): Add mbiterf. Remove mbiter.

21 months agombiterf: Add a benchmark.
Bruno Haible [Tue, 18 Jul 2023 10:15:59 +0000 (12:15 +0200)]
mbiterf: Add a benchmark.

* tests/bench-mbiterf.c: New file, based on tests/bench-mbiter.c.
* modules/mbiterf-bench-tests: New file, based on
modules/mbiter-bench-tests.

21 months agombiterf: New module.
Bruno Haible [Tue, 18 Jul 2023 10:13:57 +0000 (12:13 +0200)]
mbiterf: New module.

* lib/mbiterf.h: New file, based on lib/mbiter.h.
* lib/mbiterf.c: New file, based on lib/mbiter.c.
* modules/mbiterf: New file, based on modules/mbiter.

21 months agombstok_r: Simplify dependencies.
Bruno Haible [Tue, 18 Jul 2023 09:43:00 +0000 (11:43 +0200)]
mbstok_r: Simplify dependencies.

* lib/mbstok_r.c: Include <stdlib.h> instead of mbuiter.h.
* modules/mbstok_r (Depends-on): Remove mbuiter.

21 months agoannounce-gen: Allow using local git user.name.
Simon Josefsson [Mon, 17 Jul 2023 20:07:57 +0000 (22:07 +0200)]
announce-gen: Allow using local git user.name.

* build-aux/announce-gen (readable_interval): Remove --global
parameter to 'git config' call.

21 months agombuiter: Optimize.
Bruno Haible [Mon, 17 Jul 2023 18:50:30 +0000 (20:50 +0200)]
mbuiter: Optimize.

* lib/mbuiter.h (struct mbuiter_multi): Add cur_max field.
(mbui_init): Initialize it.
(mbuiter_multi_next): Use it instead of MB_CUR_MAX.
(mbuiter_multi_copy): Update.

21 months agombchar: Reduce size of 'struct mbchar'. Part 2.
Bruno Haible [Mon, 17 Jul 2023 17:50:27 +0000 (19:50 +0200)]
mbchar: Reduce size of 'struct mbchar'. Part 2.

* lib/mbchar.h (mb_setascii): Disable if the module 'mbfile' is not in use.
(mb_copy): Update.

21 months agombchar: Reduce size of 'struct mbchar'.
Bruno Haible [Mon, 17 Jul 2023 17:11:38 +0000 (19:11 +0200)]
mbchar: Reduce size of 'struct mbchar'.

* modules/mbfile (configure.ac): Define GNULIB_MBFILE as an indicator.
* lib/mbchar.h (MBCHAR_BUF_SIZE): Set to 4.
(struct mbchar): Disable member 'buf' if the module 'mbfile' is not in
use.

21 months agombszero: Fix for Minix.
Bruno Haible [Mon, 17 Jul 2023 16:56:19 +0000 (18:56 +0200)]
mbszero: Fix for Minix.

* lib/wchar.in.h: (_GL_MBSTATE_INIT_SIZE): Don't define on Minix.
(_GL_MBSTATE_ZERO_SIZE): Define to 4 on Minix.

21 months agombszero: Source code tweaks.
Bruno Haible [Mon, 17 Jul 2023 16:00:24 +0000 (18:00 +0200)]
mbszero: Source code tweaks.

Suggested by Paul Eggert in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-07/msg00084.html>.

* lib/wchar.in.h: Comment changes.
(_GL_MBSTATE_INIT_SIZE): Don't define on NetBSD, Solaris, native
Windows. Use a safe default at the end.
(_GL_MBSTATE_ZERO_SIZE): Don't define on AIX, IRIX, Solaris, native
Windows. Use a safe default at the end.
* lib/mbrtoc16.c: Update comments accordingly.

21 months agodfa: Optimize clearing an mbstate_t.
Bruno Haible [Sun, 16 Jul 2023 05:31:02 +0000 (07:31 +0200)]
dfa: Optimize clearing an mbstate_t.

* lib/dfa.c (mbszero) [GAWK]: Add fallback definition.
(mbs_to_wchar, lex, addtok_wc, dfaexec_main): Use mbszero.
* modules/dfa (Depends-on): Add mbszero.

21 months agouchar-c23: Optimize clearing an mbstate_t.
Bruno Haible [Sun, 16 Jul 2023 05:30:59 +0000 (07:30 +0200)]
uchar-c23: Optimize clearing an mbstate_t.

* lib/lc-charset-unicode.c (locale_encoding_to_unicode,
unicode_to_locale_encoding): Use mbszero.
* modules/uchar-c23 (Depends-on): Add mbszero.

21 months agoquotearg: Optimize clearing an mbstate_t.
Bruno Haible [Sun, 16 Jul 2023 05:30:57 +0000 (07:30 +0200)]
quotearg: Optimize clearing an mbstate_t.

* lib/quotearg.c: Include <wchar.h>.
(quotearg_buffer_restyled): Use mbszero.
* modules/quotearg (Depends-on): Add mbszero.

21 months agovasnprintf, vasnwprintf: Optimize clearing an mbstate_t.
Bruno Haible [Sun, 16 Jul 2023 05:30:55 +0000 (07:30 +0200)]
vasnprintf, vasnwprintf: Optimize clearing an mbstate_t.

* lib/vasnprintf.c (VASNPRINTF): Use mbszero.
* modules/vasnprintf (Depends-on): Add mbszero.
* modules/vasnwprintf (Depends-on): Likewise.
* modules/c-vasnprintf (Depends-on): Likewise.
* modules/unistdio/u8-vasnprintf (Depends-on): Likewise.
* modules/unistdio/u8-u8-vasnprintf (Depends-on): Likewise.
* modules/unistdio/u16-vasnprintf (Depends-on): Likewise.
* modules/unistdio/u16-u16-vasnprintf (Depends-on): Likewise.
* modules/unistdio/u32-vasnprintf (Depends-on): Likewise.
* modules/unistdio/u32-u32-vasnprintf (Depends-on): Likewise.
* modules/unistdio/ulc-vasnprintf (Depends-on): Likewise.

21 months agombmemcasecoll: Optimize clearing an mbstate_t.
Bruno Haible [Sun, 16 Jul 2023 05:30:52 +0000 (07:30 +0200)]
mbmemcasecoll: Optimize clearing an mbstate_t.

* lib/mbmemcasecoll.c (apply_c32tolower): Use mbszero.
* modules/mbmemcasecoll (Depends-on): Add mbszero.

21 months agombswidth: Optimize clearing an mbstate_t.
Bruno Haible [Sun, 16 Jul 2023 05:30:50 +0000 (07:30 +0200)]
mbswidth: Optimize clearing an mbstate_t.

* lib/mbswidth.c (mbsnwidth): Use mbszero.
* modules/mbswidth (Depends-on): Add mbszero.

21 months agombfile: Optimize clearing an mbstate_t.
Bruno Haible [Sun, 16 Jul 2023 05:30:48 +0000 (07:30 +0200)]
mbfile: Optimize clearing an mbstate_t.

* lib/mbfile.h (mbfile_multi_getc, mbf_init): Use mbszero.
* modules/mbfile (Depends-on): Add mbszero.

21 months agombuiter: Optimize clearing an mbstate_t.
Bruno Haible [Sun, 16 Jul 2023 05:30:46 +0000 (07:30 +0200)]
mbuiter: Optimize clearing an mbstate_t.

* lib/mbuiter.h: Include <wchar.h>.
(mbuiter_multi_next, mbuiter_multi_copy, mbui_init): Use mbszero.
* modules/mbuiter (Depends-on): Add mbszero.

21 months agombiter: Optimize clearing an mbstate_t.
Bruno Haible [Sun, 16 Jul 2023 05:30:43 +0000 (07:30 +0200)]
mbiter: Optimize clearing an mbstate_t.

* lib/mbiter.h: Include <wchar.h>.
(mbiter_multi_next, mbiter_multi_copy, mbi_init): Use mbszero.
* modules/mbiter (Depends-on): Add mbszero.

21 months agoc32stombs: Optimize clearing an mbstate_t.
Bruno Haible [Sun, 16 Jul 2023 05:30:41 +0000 (07:30 +0200)]
c32stombs: Optimize clearing an mbstate_t.

* lib/c32stombs.c (c32stombs): Use mbszero.
* lib/uchar.in.h (c32stombs): Likewise.
* modules/c32stombs (Depends-on): Add mbszero.

21 months agombstoc32s: Optimize clearing an mbstate_t.
Bruno Haible [Sun, 16 Jul 2023 05:30:37 +0000 (07:30 +0200)]
mbstoc32s: Optimize clearing an mbstate_t.

* lib/mbstoc32s.c (mbstoc32s): Use mbszero.
* lib/uchar.in.h (mbstoc32s): Likewise.
* modules/mbstoc32s (Depends-on): Add mbszero.

21 months agombstowcs: Optimize clearing an mbstate_t.
Bruno Haible [Sun, 16 Jul 2023 05:30:35 +0000 (07:30 +0200)]
mbstowcs: Optimize clearing an mbstate_t.

* lib/mbstowcs.c (mbstowcs): Use mbszero.
* modules/mbstowcs (Depends-on): Add mbszero.

21 months agoc32tob: Optimize clearing an mbstate_t.
Bruno Haible [Sun, 16 Jul 2023 05:30:33 +0000 (07:30 +0200)]
c32tob: Optimize clearing an mbstate_t.

* lib/c32tob.c (c32tob): Use mbszero.
* modules/c32tob (Depends-on): Add mbszero.

21 months agowctomb: Optimize clearing an mbstate_t.
Bruno Haible [Sun, 16 Jul 2023 05:30:30 +0000 (07:30 +0200)]
wctomb: Optimize clearing an mbstate_t.

* lib/wctomb-impl.h (wctomb): Use mbszero.
* modules/wctomb (Depends-on): Add mbszero.

21 months agobtoc32: Optimize clearing an mbstate_t.
Bruno Haible [Sun, 16 Jul 2023 05:30:27 +0000 (07:30 +0200)]
btoc32: Optimize clearing an mbstate_t.

* lib/btoc32.c: Include <wchar.h>.
(btoc32): Use mbszero.
* modules/btoc32 (Depends-on): Add mbszero.

21 months agobtowc: Optimize clearing an mbstate_t.
Bruno Haible [Sun, 16 Jul 2023 05:30:25 +0000 (07:30 +0200)]
btowc: Optimize clearing an mbstate_t.

* lib/btowc.c (btowc): Use mbszero.
* modules/btowc (Depends-on): Add mbszero.

21 months agombrtoc32: Optimize clearing an mbstate_t.
Bruno Haible [Sun, 16 Jul 2023 05:30:22 +0000 (07:30 +0200)]
mbrtoc32: Optimize clearing an mbstate_t.

* lib/mbrtoc32.c (mbrtoc32): Use mbszero.
* modules/mbrtoc32 (Depends-on): Add mbsinit, mbszero.

21 months agombtowc: Optimize clearing an mbstate_t.
Bruno Haible [Sun, 16 Jul 2023 05:30:20 +0000 (07:30 +0200)]
mbtowc: Optimize clearing an mbstate_t.

* lib/mbtowc-impl.h (mbtowc): Use mbszero.
* modules/mbtowc (Depends-on): Add mbszero.

21 months agombszero: New module.
Bruno Haible [Sun, 16 Jul 2023 05:30:15 +0000 (07:30 +0200)]
mbszero: New module.

* lib/wchar.in.h: Include <string.h>.
(_GL_MBSTATE_INIT_SIZE, _GL_MBSTATE_ZERO_SIZE): New macros.
(mbszero): New declaration.
* lib/mbrtoc16.c: Update comments.
* lib/mbszero.c: New file.
* m4/wchar_h.m4 (gl_WCHAR_H_REQUIRE_DEFAULTS): Initialize
GNULIB_MBSZERO.
* modules/wchar (Depends-on): Add extern-inline.
(Makefile.am): Substitute GNULIB_MBSZERO.
* modules/mbszero: New file.

21 months agombsinit: Fix module description.
Bruno Haible [Sat, 15 Jul 2023 20:47:26 +0000 (22:47 +0200)]
mbsinit: Fix module description.

* modules/mbsinit (Files): Add m4/mbrtowc.m4.

21 months agoc32_apply_type_test: Fix compilation error with GCC < 9.
Bruno Haible [Sat, 15 Jul 2023 07:47:06 +0000 (09:47 +0200)]
c32_apply_type_test: Fix compilation error with GCC < 9.

* lib/uchar.in.h (c32_apply_type_test) [_GL_WCHAR_T_IS_UCS4]: Remove
_GL_ARG_NONNULL attribute.

21 months agombchar: Optimize is_basic.
Bruno Haible [Thu, 13 Jul 2023 21:23:41 +0000 (23:23 +0200)]
mbchar: Optimize is_basic.

* lib/mbchar.h (is_basic_table): Remove declaration.
(is_basic) [IS_BASIC_ASCII]: Define through a simple range test.
* lib/mbchar.c (is_basic_table): Remove array.

21 months agolocalcharset: Clean up locale encodings used by glibc.
Bruno Haible [Thu, 13 Jul 2023 20:59:48 +0000 (22:59 +0200)]
localcharset: Clean up locale encodings used by glibc.

* lib/localcharset.h: Remove VISCII from the list, since never supported
in glibc/localedata/SUPPORTED. JOHAB is not supported by glibc any more
since 2000-09-25. TCVN5712-1 is not supported by glibc any more since
2012-05-21.

21 months agodoc: Mention c32_get_mapping, c32_apply_mapping.
Bruno Haible [Thu, 13 Jul 2023 11:42:08 +0000 (13:42 +0200)]
doc: Mention c32_get_mapping, c32_apply_mapping.

* doc/posix-functions/wctrans.texi: Mention c32_get_mapping.
* doc/posix-functions/towctrans.texi: Mention c32_apply_mapping.
* doc/strings.texi (Comparison of character APIs): Mention both.

21 months agoc32_apply_mapping: Add tests.
Bruno Haible [Thu, 13 Jul 2023 11:37:01 +0000 (13:37 +0200)]
c32_apply_mapping: Add tests.

* tests/test-c32_apply_mapping.c: New file.
* modules/c32_apply_mapping-tests: New file.

21 months agoc32_apply_mapping: New module.
Bruno Haible [Thu, 13 Jul 2023 09:30:54 +0000 (11:30 +0200)]
c32_apply_mapping: New module.

* lib/uchar.in.h (c32_apply_mapping): New declaration.
* lib/c32_apply_mapping.c: New file.
* m4/uchar_h.m4 (gl_UCHAR_H_REQUIRE_DEFAULTS): Initialize
GNULIB_C32_APPLY_MAPPING.
* modules/uchar (Makefile.am): Substitute GNULIB_C32_APPLY_MAPPING.
* modules/c32_apply_mapping: New file.

21 months agoc32_get_mapping: Add tests.
Bruno Haible [Thu, 13 Jul 2023 09:19:04 +0000 (11:19 +0200)]
c32_get_mapping: Add tests.

* tests/test-c32_get_mapping.c: New file.
* modules/c32_get_mapping-tests: New file.

21 months agoc32_get_mapping: New module.
Bruno Haible [Thu, 13 Jul 2023 09:15:04 +0000 (11:15 +0200)]
c32_get_mapping: New module.

* lib/uchar.in.h (c32_mapping_t): New type.
(c32_get_mapping): New declaration.
* lib/c32_get_mapping.c: New file, based on lib/wctrans-impl.h.
* m4/uchar_h.m4 (gl_UCHAR_H_REQUIRE_DEFAULTS): Initialize
GNULIB_C32_GET_MAPPING.
* modules/uchar (Makefile.am): Substitute GNULIB_C32_GET_MAPPING.
* modules/c32_get_mapping: New file.

21 months agotowctrans: Relax license.
Bruno Haible [Thu, 13 Jul 2023 09:01:22 +0000 (11:01 +0200)]
towctrans: Relax license.

* modules/towctrans (License): Change to LGPLv2+.
* lib/towctrans.c: Update license notice.
* lib/towctrans-impl.h: Likewise.

21 months agowctrans: Relax license.
Bruno Haible [Thu, 13 Jul 2023 08:58:56 +0000 (10:58 +0200)]
wctrans: Relax license.

* modules/wctrans (License): Change to LGPLv2+.
* lib/wctrans.c: Update license notice.
* lib/wctrans-impl.h: Likewise.

21 months agodoc: Mention c32_get_type_test, c32_apply_type_test.
Bruno Haible [Wed, 12 Jul 2023 22:58:13 +0000 (00:58 +0200)]
doc: Mention c32_get_type_test, c32_apply_type_test.

* doc/posix-functions/wctype.texi: Mention c32_get_type_test.
* doc/posix-functions/iswctype.texi: Mention c32_apply_type_test.
* doc/strings.texi (Comparison of character APIs): Mention both.

21 months agoc32_apply_type_test: Add tests.
Bruno Haible [Wed, 12 Jul 2023 22:52:19 +0000 (00:52 +0200)]
c32_apply_type_test: Add tests.

* tests/test-c32_apply_type_test.c: New file.
* modules/c32_apply_type_test-tests: New file.

21 months agoc32_apply_type_test: New module.
Bruno Haible [Wed, 12 Jul 2023 22:50:29 +0000 (00:50 +0200)]
c32_apply_type_test: New module.

* lib/uchar.in.h (c32_apply_type_test): New declaration.
* lib/c32_apply_type_test.c: New file.
* m4/uchar_h.m4 (gl_UCHAR_H_REQUIRE_DEFAULTS): Initialize
GNULIB_C32_APPLY_TYPE_TEST.
* modules/uchar (Makefile.am): Substitute GNULIB_C32_APPLY_TYPE_TEST.
* modules/c32_apply_type_test: New file.

21 months agoc32_get_type_test: Add tests.
Bruno Haible [Wed, 12 Jul 2023 22:11:20 +0000 (00:11 +0200)]
c32_get_type_test: Add tests.

* tests/test-c32_get_type_test.c: New file.
* modules/c32_get_type_test-tests: New file.

21 months agoc32_get_type_test: New module.
Bruno Haible [Wed, 12 Jul 2023 20:44:52 +0000 (22:44 +0200)]
c32_get_type_test: New module.

* lib/uchar.in.h (c32_type_test_t): New type.
(c32_get_type_test): New declaration.
* lib/c32_get_type_test.c: New file, based on lib/wctype-impl.h.
* m4/uchar_h.m4 (gl_UCHAR_H_REQUIRE_DEFAULTS): Initialize
GNULIB_C32_GET_TYPE_TEST.
* modules/uchar (Makefile.am): Substitute GNULIB_C32_GET_TYPE_TEST.
* modules/c32_get_type_test: New file.

21 months agoiswctype: Relax license.
Bruno Haible [Wed, 12 Jul 2023 20:25:52 +0000 (22:25 +0200)]
iswctype: Relax license.

* modules/iswctype (License): Change to LGPLv2+.
* lib/iswctype.c: Update license notice.
* lib/iswctype-impl.h: Likewise.

21 months agowctype: Relax license.
Bruno Haible [Wed, 12 Jul 2023 20:25:14 +0000 (22:25 +0200)]
wctype: Relax license.

* modules/wctype (License): Change to LGPLv2+.
* lib/wctype.c: Update license notice.
* lib/wctype-impl.h: Likewise.

21 months agombiter, mbuiter: Small optimization.
Bruno Haible [Wed, 12 Jul 2023 15:33:14 +0000 (17:33 +0200)]
mbiter, mbuiter: Small optimization.

* lib/mbiter.h: Optimize away the in_shift field when the module
'mbrtoc32-regular' is in use.
* lib/mbuiter.h: Likewise.

21 months agogendocs: support chapter- and section-level split
Gavin Smith [Wed, 12 Jul 2023 14:00:40 +0000 (16:00 +0200)]
gendocs: support chapter- and section-level split

* doc/gendocs_template: Add lines to mark parts of file to output
only when splitting HTML by node.
Remove obsolete comment about ranges of years in copyright notice
(as per Karl).
* build-aux/gendocs.sh
[!texi2html]: Strip out parts of the template depending on --split.
[texi2html] Include all of the template as before.

21 months agombsrtoc32s, mbsnrtoc32s: Small optimization.
Bruno Haible [Tue, 11 Jul 2023 22:58:51 +0000 (00:58 +0200)]
mbsrtoc32s, mbsnrtoc32s: Small optimization.

* lib/mbsrtoc32s.c (USES_C32): Set to 0 when the module
'mbrtoc32-regular' is in use.
* lib/mbsnrtoc32s.c (USES_C32): Likewise.

21 months agombswidth: Add a benchmark.
Bruno Haible [Tue, 11 Jul 2023 19:55:47 +0000 (21:55 +0200)]
mbswidth: Add a benchmark.

* tests/bench-mbswidth.c: New file, based on tests/bench-mbiter.c.
* modules/mbswidth-bench-tests: New file.

21 months agombuiter: Add a benchmark.
Bruno Haible [Tue, 11 Jul 2023 19:54:54 +0000 (21:54 +0200)]
mbuiter: Add a benchmark.

* tests/bench-mbuiter.c: New file, based on tests/bench-mbiter.c.
* modules/mbuiter-bench-tests: New file.

21 months agombiter: Add a benchmark.
Bruno Haible [Tue, 11 Jul 2023 19:54:01 +0000 (21:54 +0200)]
mbiter: Add a benchmark.

* tests/bench-mbiter.c: New file.
* tests/bench-multibyte.h: New file.
* modules/mbiter-bench-tests: New file.

21 months agotests: Create new file bench.h.
Bruno Haible [Tue, 11 Jul 2023 19:43:27 +0000 (21:43 +0200)]
tests: Create new file bench.h.

* tests/bench.h: New file, extracted from tests/bench-digest.h.
* tests/bench-digest.h: Include it.
* modules/crypto/md5-buffer-tests (Files): Add tests/bench.h.
* modules/crypto/sha1-buffer-tests (Files): Likewise.
* modules/crypto/sha256-buffer-tests (Files): Likewise.
* modules/crypto/sha512-buffer-tests (Files): Likewise.

21 months agoOptimize away some mbsinit calls.
Bruno Haible [Tue, 11 Jul 2023 19:30:44 +0000 (21:30 +0200)]
Optimize away some mbsinit calls.

* lib/mbiter.h (mbiter_multi_next): When the module 'mbrtoc32-regular'
is in use, don't invoke mbsinit and don't compare the mbrtoc32 result
against (size_t)(-3).
* lib/mbuiter.h (mbuiter_multi_next): Likewise.
* lib/mbfile.h (mbfile_multi_getc): Likewise.
* lib/mbswidth.c (mbsnwidth): Likewise.
* lib/mbmemcasecoll.c (apply_c32tolower): Likewise.
* lib/quotearg.c (quotearg_buffer_restyled): Likewise.

21 months agoFix build errors on Linux/hppa.
Bruno Haible [Tue, 11 Jul 2023 08:08:18 +0000 (10:08 +0200)]
Fix build errors on Linux/hppa.

* modules/math (Makefile.am): Split long pipe command into several
smaller commands.
* modules/pthread-h (Makefile.am): Likewise.
* modules/stdio (Makefile.am): Likewise.
* modules/stdlib (Makefile.am): Likewise.
* modules/string (Makefile.am): Likewise.
* modules/unictype/base (Makefile.am): Likewise.
* modules/unistd (Makefile.am): Likewise.
* modules/wchar (Makefile.am): Likewise.

21 months agoquotearg: update Solaris-related comments
Paul Eggert [Tue, 11 Jul 2023 17:46:04 +0000 (10:46 -0700)]
quotearg: update Solaris-related comments

* doc/solaris-versions: Modernize.
* lib/quotearg.c: Update comments.

21 months agoMore than one initial mbstate_t
Paul Eggert [Tue, 11 Jul 2023 14:54:01 +0000 (07:54 -0700)]
More than one initial mbstate_t

In commentary, say "an initial state" rather than
"the initial state" for mbstate_t, as it is possible
and indeed common for there to be more than one
initial state.  POSIX routinely says "an initial state".

21 months agodfa: Overcome wchar_t limitations.
Bruno Haible [Mon, 10 Jul 2023 22:52:23 +0000 (00:52 +0200)]
dfa: Overcome wchar_t limitations.

* lib/localeinfo.h: Include <uchar.h>. Add special definitions for GAWK.
(case_folded_counterparts): Change array element type to char32_t.
* lib/localeinfo.c: Include <uchar.h>. Add special definitions for GAWK.
(is_using_utf8, init_localeinfo): Use mbrtoc32 instead of mbrtowc.
(lonesome_lower): Change element type to 'unsigned short'.
(case_folded_counterparts): Change array element type to char32_t. Use
c32toupper instead of towupper. Use c32tolower instead of towlower.
* lib/dfa.c: Include <uchar.h>. Add special definitions for GAWK.
(struct mb_char_classes): Change element type of 'chars' to char32_t.
(mbs_to_wchar): Use mbrtoc32 instead of mbrtowc.
(setbit_wc): Change type of first argument to char32_t. Use c32tob
instead of wctob.
(parse_bracket_exp): Update.
(lex): Use c32isprint instead of iswprint. Use c32isspace instead of
iswspace. Use c32rtomb instead of a %lc directive.
(addtok_wc): Use c32rtomb instead of wcrtomb.
(atom): Update.
* modules/dfa (Depends-on): Remove wctype-h. Add uchar,
mbrtoc32-regular, c32rtomb, c32tob, c32tolower, c32toupper, c32isprint,
c32isspace.
(Link): Add $(LIBUNISTRING) $(LIBC32CONV).
* modules/dfa-tests (Makefile.am): Link test-dfa-match-aux with
$(LIBUNISTRING) $(LIBC32CONV).
* NEWS: Mention the change.

21 months agombrtoc32-regular: Add tests.
Bruno Haible [Mon, 10 Jul 2023 22:06:14 +0000 (00:06 +0200)]
mbrtoc32-regular: Add tests.

* tests/test-mbrtoc32-regular.c: New file.
* modules/mbrtoc32-regular-tests: New file.

21 months agombrtoc32-regular: New module.
Bruno Haible [Mon, 10 Jul 2023 22:03:34 +0000 (00:03 +0200)]
mbrtoc32-regular: New module.

* modules/mbrtoc32-regular: New file.
* lib/mbrtoc32.c (mbrtoc32): If the module 'mbrtoc32-regular' is present
and the system's mbrtoc32 returned a char32_t, clear the mbstate_t.
* doc/posix-functions/mbrtoc32.texi: Mention the new module.

21 months agoRevert "dfa: Overcome wchar_t limitations."
Bruno Haible [Mon, 10 Jul 2023 21:17:12 +0000 (23:17 +0200)]
Revert "dfa: Overcome wchar_t limitations."

21 months agoApply the last change to all locale-*.m4 files.
Bruno Haible [Mon, 10 Jul 2023 21:11:25 +0000 (23:11 +0200)]
Apply the last change to all locale-*.m4 files.

* m4/locale-ar.m4 (gt_LOCALE_AR): Reject locale name that might cause
trouble with sh or make.
* m4/locale-tr.m4 (gt_LOCALE_TR_UTF8): Likewise.

21 months agodfa: Overcome wchar_t limitations.
Bruno Haible [Fri, 7 Jul 2023 10:04:14 +0000 (12:04 +0200)]
dfa: Overcome wchar_t limitations.

* lib/localeinfo.h: Include <uchar.h>. Add special definitions for GAWK.
(case_folded_counterparts): Change array element type to char32_t.
* lib/localeinfo.c: Include <uchar.h>. Add special definitions for GAWK.
(is_using_utf8, init_localeinfo): Use mbrtoc32 instead of mbrtowc.
(lonesome_lower): Change element type to 'unsigned short'.
(case_folded_counterparts): Change array element type to char32_t. Use
c32toupper instead of towupper. Use c32tolower instead of towlower.
* lib/dfa.c: Include <uchar.h>. Add special definitions for GAWK.
(struct mb_char_classes): Change element type of 'chars' to char32_t.
(mbs_to_wchar): Use mbrtoc32 instead of mbrtowc.
(setbit_wc): Change type of first argument to char32_t. Use c32tob
instead of wctob.
(parse_bracket_exp): Update.
(lex): Use c32isprint instead of iswprint. Use c32isspace instead of
iswspace. Use c32rtomb instead of a %lc directive.
(addtok_wc): Use c32rtomb instead of wcrtomb.
(atom): Update.
* modules/dfa (Depends-on): Remove wctype-h. Add uchar, mbrtoc32,
c32rtomb, c32tob, c32tolower, c32toupper, c32isprint, c32isspace.
(Link): Add $(LIBUNISTRING) $(LIBC32CONV).
* modules/dfa-tests (Makefile.am): Link test-dfa-match-aux with
$(LIBUNISTRING) $(LIBC32CONV).
* NEWS: Mention the change.

21 months agoc32width: protect against bad configure args
Paul Eggert [Sun, 9 Jul 2023 18:23:58 +0000 (11:23 -0700)]
c32width: protect against bad configure args

Avoid ‘test’ misuse with ‘./configure gt_cv_locale_fr=""’.
Possible problem of this sort reported by Angelo Graziosi in:
https://lists.gnu.org/r/emacs-devel/2023-07/msg00329.html
* m4/locale-fr.m4 (gt_LOCALE_FR_UTF8, gt_LOCALE_FR_UTF8):
* m4/locale-ja.m4 (gt_LOCALE_JA):
* m4/locale-zh.m4 (gt_LOCALE_ZH_CN):
Reject locale names that might cause trouble with sh or make.

22 months agowcscmp: Work around a glibc bug.
Bruno Haible [Thu, 6 Jul 2023 22:53:00 +0000 (00:53 +0200)]
wcscmp: Work around a glibc bug.

Reported by مصعب الزعبي (Mosab Al-Zoubi) <moceap@hotmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-07/msg00029.html>.

* m4/wcscmp.m4 (gl_FUNC_WCSCMP): Test against a glibc/arm* bug.
* doc/posix-functions/wcscmp.texi: Mention the glibc/arm* bug.

22 months agombiter, mbfile, mbmemcasecoll: Improve handling of mbrtoc32 result.
Bruno Haible [Tue, 4 Jul 2023 19:04:00 +0000 (21:04 +0200)]
mbiter, mbfile, mbmemcasecoll: Improve handling of mbrtoc32 result.

* lib/mbiter.h (mbi_avail): If cur.ptr has reached the limit but
in_shift is true, call mbiter_multi_next.
(mbiter_multi_next): Set in_shift to false after an incomplete multibyte
character.
* lib/mbfile.h (mbfile_multi_getc): Pass the input bytes incrementally
into mbrtoc32. When mbf->state is not in the initial state, call
mbrtoc32 again.
* lib/mbmemcasecoll.c (apply_c32tolower): When the state is not in the
initial state, call mbrtoc32 again.

22 months agombiter, mbuiter, mbfile: Improve state handling after invalid input.
Bruno Haible [Tue, 4 Jul 2023 19:03:01 +0000 (21:03 +0200)]
mbiter, mbuiter, mbfile: Improve state handling after invalid input.

* lib/mbiter.h (mbiter_multi_next): After an invalid multibyte sequence
was encountered, clear the state.
* lib/mbuiter.h (mbuiter_multi_next): Likewise.
* lib/mbfile.h (mbfile_multi_getc): Likewise.

22 months agoautoupdate
Karl Berry [Tue, 4 Jul 2023 14:19:04 +0000 (07:19 -0700)]
autoupdate

22 months agombchar: Optimize all chars from the POSIX "portable character set".
Bruno Haible [Tue, 4 Jul 2023 13:31:09 +0000 (15:31 +0200)]
mbchar: Optimize all chars from the POSIX "portable character set".

* lib/mbchar.h (is_basic): Include all the characters from the POSIX
"portable character set".
* lib/mbchar.c (is_basic_table): Likewise.
* lib/mbiter.h (mbiter_multi_next): Update comment.
* lib/mbuiter.h (mbuiter_multi_next): Likewise.
* lib/mbfile.h (mbfile_multi_getc): Likewise.

22 months agombchar: treat @, $, ` as basic
Paul Eggert [Mon, 3 Jul 2023 17:54:36 +0000 (10:54 -0700)]
mbchar: treat @, $, ` as basic

The C standard says that @, $, ` must have a single-byte
representation so they count as basic as far as multibyte
character processing goes.
* lib/mbchar.c (is_basic_table):
* lib/mbchar.h (is_basic):
* lib/mbswidth.c (mbsnwidth):
Treat @, $, ` as basic too.

22 months agombrtoc32: Document another glibc bug.
Bruno Haible [Mon, 3 Jul 2023 21:41:32 +0000 (23:41 +0200)]
mbrtoc32: Document another glibc bug.

* doc/posix-functions/mbrtoc32.texi: Reference the glibc bug in
BIG5-HKSCS locales.

22 months agombrtoc32: document (size_t) -3 issue
Paul Eggert [Mon, 3 Jul 2023 17:24:05 +0000 (10:24 -0700)]
mbrtoc32: document (size_t) -3 issue

* doc/posix-functions/mbrtoc32.texi (mbrtoc32):
Say (size_t) -3 might not be worth bothering about.

22 months agoautoupdate
Karl Berry [Mon, 3 Jul 2023 14:20:20 +0000 (07:20 -0700)]
autoupdate

22 months agombsrtoc32s: Accommodate a difference between mbrtowc and mbrtoc32.
Bruno Haible [Sun, 2 Jul 2023 14:46:11 +0000 (16:46 +0200)]
mbsrtoc32s: Accommodate a difference between mbrtowc and mbrtoc32.

* lib/mbsrtoc32s.c (USES_C32): New macro.
* lib/mbsrtowcs.c (USES_C32): New macro.
* lib/mbsrtowcs-impl.h (FUNC): If USES_C32 and mbrtoc32 returned
(size_t)(-3), don't increment the pointer.