]> git.ipfire.org Git - thirdparty/gnulib.git/log
thirdparty/gnulib.git
8 months agospin: Add tests.
Bruno Haible [Wed, 14 May 2025 11:57:28 +0000 (13:57 +0200)] 
spin: Add tests.

* tests/test-spin1.c: New file, based on tests/test-asyncsafe-spin1.c.
* tests/test-spin2.c: New file, based on tests/test-asyncsafe-spin2.c.
* modules/spin-tests: New file.

8 months agospin: New module.
Bruno Haible [Wed, 14 May 2025 10:51:46 +0000 (12:51 +0200)] 
spin: New module.

* lib/glthread/spin.h: New file, based on lib/glthread/lock.h and
lib/asyncsafe-spin.h.
* lib/glthread/spin.c: New file, based on lib/asyncsafe-spin.c.
* modules/spin: New file.
* doc/multithread.texi (Choosing a multithreading API): Spin locks no
longer require POSIX threads.
(Gnulib multithreading): Mention the 'spin' module.

8 months agofile-has-acl: Fix compilation error on Solaris (regression 2025-05-09).
Bruno Haible [Mon, 12 May 2025 12:11:02 +0000 (14:11 +0200)] 
file-has-acl: Fix compilation error on Solaris (regression 2025-05-09).

* lib/file-has-acl.c (acl_get_fdfile): Don't define on platforms that
don't need it.

8 months agodoc: Update doc about ACLs on Cygwin.
Bruno Haible [Mon, 12 May 2025 12:01:42 +0000 (14:01 +0200)] 
doc: Update doc about ACLs on Cygwin.

* doc/acl-resources.txt: Update function list for Cygwin >= 2.5.

8 months agoobstack: Fix compilation error on MSVC (regression 2025-05-07).
Bruno Haible [Mon, 12 May 2025 11:22:06 +0000 (13:22 +0200)] 
obstack: Fix compilation error on MSVC (regression 2025-05-07).

* lib/obstack.in.h (obstack_free): Fix typo.

8 months agodoc: Update for a few recently fixed Hurd bugs.
Bruno Haible [Mon, 12 May 2025 10:43:59 +0000 (12:43 +0200)] 
doc: Update for a few recently fixed Hurd bugs.

* doc/posix-functions/utimensat.texi: List the affected glibc versions.
* doc/posix-functions/futimens.texi: Likewise.
* doc/posix-functions/linkat.texi: Likewise.
* doc/glibc-functions/renameat2.texi: Likewise.

8 months agofts: Generate fts_.h.
Collin Funk [Sun, 11 May 2025 00:39:26 +0000 (17:39 -0700)] 
fts: Generate fts_.h.

Suggested by Bruno Haible in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-05/msg00134.html>.

* lib/fts_.h: Remove file.
* lib/fts.in.h: New file.
* m4/fts.m4 (gl_FUNC_FTS_CORE): Use gl_CHECK_HEADER_SYS_CDEFS_H instead
of AC_CHECK_HEADERS_ONCE.
* modules/fts (Files): Remove lib/fts_.h. Add lib/fts.in.h and
m4/sys_cdefs_h.m4.
(Depends-on): Add gen-header.
(Makefile.am): Add fts_.h to BUILT_SOURCES. Generate fts_.h using
fts.in.h while replacing @HAVE_SYS_CDEFS_H@. Add fts_.h and fts_.h-t to
MOSTLYCLEANFILES.

8 months agostring-h, wchar-h: Fix some g++ -Wsystem-headers warnings.
Bruno Haible [Mon, 12 May 2025 01:05:51 +0000 (03:05 +0200)] 
string-h, wchar-h: Fix some g++ -Wsystem-headers warnings.

* lib/string.in.h (memcpy, memccpy, memmove, strncpy, strndup, strncat,
memcmp, strncmp, memset): On glibc systems, declare with
_GL_ATTRIBUTE_NOTHROW.
* lib/wchar.in.h (wmemcpy, wmemmove, wcsncpy, wcsncat, wmemcmp, wcsncmp,
wmemset): Likewise.

8 months agoqsort-tests: Fix a clang -Wpedantic warning.
Bruno Haible [Sun, 11 May 2025 23:34:26 +0000 (01:34 +0200)] 
qsort-tests: Fix a clang -Wpedantic warning.

* tests/test-qsort.c (lib_qsort): Remove a redundant 'return'.

8 months agoSilence some more gcc 15 -Wunterminated-string-initialization warnings.
Bruno Haible [Sun, 11 May 2025 22:42:33 +0000 (00:42 +0200)] 
Silence some more gcc 15 -Wunterminated-string-initialization warnings.

* lib/uninorm/composition.c (struct composition_rule): Mark codes[] as
nonstring.
* lib/gen-uni-tables.c (output_composition_tables): Emit the same
'struct composition_rule' definition.
* lib/uninorm/composition-table.gperf: Regenerated.

8 months agogen-uni-tables: Fix logic mistake (regression 2025-01-03).
Bruno Haible [Sun, 11 May 2025 22:49:32 +0000 (00:49 +0200)] 
gen-uni-tables: Fix logic mistake (regression 2025-01-03).

* lib/gen-uni-tables.c (is_property_composite): Fix mistake.

8 months agogen-uni-tables: Fix compilation error (regression 2025-01-03).
Bruno Haible [Sun, 11 May 2025 21:50:45 +0000 (23:50 +0200)] 
gen-uni-tables: Fix compilation error (regression 2025-01-03).

* lib/gen-uni-tables.c (str_startswith): New function, from
lib/str_startswith.c.
(str_endswith): New function, from lib/str_endswith.c.

8 months agoHACKING: Add documentation regarding link dependencies.
Bruno Haible [Sun, 11 May 2025 20:07:59 +0000 (22:07 +0200)] 
HACKING: Add documentation regarding link dependencies.

* HACKING (Maintaining link dependencies): New section.

8 months agobison: Fix configure test failure if POSIXLY_CORRECT is set.
Bruno Haible [Sun, 11 May 2025 19:28:31 +0000 (21:28 +0200)] 
bison: Fix configure test failure if POSIXLY_CORRECT is set.

Reported by Arsen Arsenović.

* m4/bison.m4 (gl_PROG_BISON): In the bison invocation, put all options
before the non-option arguments.

8 months agofts: Make sure __GNU_PREREQ is defined (regression yesterday).
Collin Funk [Sun, 11 May 2025 16:41:48 +0000 (09:41 -0700)] 
fts: Make sure __GNU_PREREQ is defined (regression yesterday).

Reported by <nroycea+gnu@gmail.com> in
<https://debbugs.gnu.org/cgi/bugreport.cgi?bug=78376>.

* lib/fts_.h (__GNUC_PREREQ): Define macro on clang or if the system
does not define it.

9 months agostring-desc: Fixes for string literals and older GCC versions.
Bruno Haible [Sun, 11 May 2025 00:55:11 +0000 (02:55 +0200)] 
string-desc: Fixes for string literals and older GCC versions.

* lib/string-desc.h (HAVE__GENERIC, HAVE_BUILTIN_CHOOSE_EXPR,
HAVE_BUILTIN_CONSTANT_P, HAVE_RW_STRING_DESC): New macros.
Use HAVE_RW_STRING_DESC instead of HAVE_STATEMENT_EXPRESSIONS
everywhere.
(sd_new_addr): Use __builtin_choose_expr to deal with string literals.
* lib/xstring-desc.h: Use HAVE_RW_STRING_DESC instead of
HAVE_STATEMENT_EXPRESSIONS.
* lib/string-buffer.c (sb_dupfree): Construct an empty writable string
without a cast.
* lib/xstring-buffer.c (sb_xdupfree): Likewise.
* lib/string-buffer-reversed.c (sbr_dupfree): Likewise.
* lib/xstring-buffer-reversed.c (sbr_xdupfree): Likewise.

9 months agofts: Fix redefinition of __THROW.
Collin Funk [Sat, 10 May 2025 23:07:57 +0000 (16:07 -0700)] 
fts: Fix redefinition of __THROW.

* lib/fts_.h: Include <sys/cdefs.h> if the system has it.
(__THROW, __BEGIN_DECLS, __END_DECLS): Define properly if not previously
defined.
* m4/fts.m4 (gl_FUNC_FTS_CORE): Check for sys/cdefs.h.

9 months agostring-desc, xstring-desc: Avoid GCC attributes in function definitions.
Bruno Haible [Sat, 10 May 2025 15:12:28 +0000 (17:12 +0200)] 
string-desc, xstring-desc: Avoid GCC attributes in function definitions.

Reported by Collin Funk in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-05/msg00126.html>.

* lib/attribute.h: Clarify the allowed positions of attributes in
function definitions.
* lib/string-desc.h (_sd_char_at): Add a declaration, to hold the
gcc attrribute.
* lib/xstring-desc.h (_xsd_c): Likewise.

9 months agostring-desc: Improve a declaration.
Bruno Haible [Sat, 10 May 2025 13:06:47 +0000 (15:06 +0200)] 
string-desc: Improve a declaration.

* lib/string-desc.h (_sd_char_at): Use _GL_ATTRIBUTE_NONNULL, not
_GL_ATTRIBUTE_NONNULL_IF_NONZERO.

9 months agoqcopy-acl: Update link dependencies after yesterday's change.
Bruno Haible [Sat, 10 May 2025 12:07:36 +0000 (14:07 +0200)] 
qcopy-acl: Update link dependencies after yesterday's change.

* m4/acl.m4 (gl_QCOPY_ACL): Require gl_FILE_HAS_ACL.
(QCOPY_ACL_LIB): Conditionally add $FILE_HAS_ACL_LIB.
* modules/acl-tests (Makefile.am): Revert last change.

9 months agofile-has-acl: Simplify logic for FILE_HAS_ACL_LIB.
Bruno Haible [Sat, 10 May 2025 11:36:12 +0000 (13:36 +0200)] 
file-has-acl: Simplify logic for FILE_HAS_ACL_LIB.

* m4/acl.m4 (gl_FUNC_ACL_ARG): Don't set gl_need_lib_has_acl.
(gl_FUNC_ACL): Don't set FILE_HAS_ACL_LIB.
(gl_FILE_HAS_ACL): Require gl_FUNC_ACL. Don't set gl_need_lib_has_acl.

9 months agoacl-tests: link with $(FILE_HAS_ACL_LIB)
Paul Eggert [Sat, 10 May 2025 01:48:03 +0000 (18:48 -0700)] 
acl-tests: link with $(FILE_HAS_ACL_LIB)

* modules/acl-tests (test_copy_acl_LDADD): Add
$(FILE_HAS_ACL_LIB), since qcopy-acl depends on file-has-acl.
Although this suggests that QCOPY_ACL_LIB should contain
FILE_HAS_ACL_LIB, I’m not sure whether that’s the right course of
action and anyway this is good enough for coreutils.

9 months agostring-desc: Distinguish writable strings from read-only strings.
Bruno Haible [Sat, 10 May 2025 01:16:52 +0000 (03:16 +0200)] 
string-desc: Distinguish writable strings from read-only strings.

* lib/string-desc.h (HAVE_STATEMENT_EXPRESSIONS): New macro.
(rw_string_desc_t): New type.
(string_desc_t) [HAVE_STATEMENT_EXPRESSIONS]: Change field _data from
'char *' to 'const char *'.
(sd_readonly, sd_readwrite): New inline functions.
(sd_length): Define through a macro with _Generic.
(sd_char_at): Define through a macro and an inline function.
(sd_data, sd_is_empty): Define through a macro with _Generic.
(sd_equals, sd_startswith, sd_endswith, sd_cmp, sd_c_casecmp, sd_index,
sd_last_index, sd_contains): Define through a macro.
(sd_new_addr): Define through a macro with _Generic.
(sd_substring, sd_write, sd_fwrite): Define through a macro.
(sd_new, sd_new_filled): Change parameter type.
(sd_copy): Define through a macro.
(sd_concat): Change parameter type.
(sd_c): Define through a macro.
(sd_set_char_at, sd_fill): Change parameter type.
(sd_overwrite): Define through a macro.
(sd_free): Change parameter type.
* lib/string-desc.c (_sd_equals): Renamed from sd_equals. Take scalar
parameters.
(_sd_startswith): Renamed from sd_startswith. Take scalar parameters.
(_sd_endswith): Renamed from sd_endswith. Take scalar parameters.
(_sd_cmp): Renamed from sd_cmp. Take scalar parameters.
(_sd_c_casecmp): Renamed from sd_c_casecmp. Take scalar parameters.
(_sd_index): Renamed from sd_index. Take scalar parameters.
(_sd_last_index): Renamed from sd_last_index. Take scalar parameters.
(_sd_new_addr, _rwsd_new_addr): Renamed from sd_new_addr.
(sd_substring): Remove function.
(_sd_write): Renamed from sd_write. Take scalar parameters.
(_sd_fwrite): Renamed from sd_fwrite. Take scalar parameters.
(sd_new, sd_new_filled): Change parameter type.
(_sd_copy): Renamed from sd_copy. Change parameter type. Take scalar
parameters.
(sd_concat): Change parameter type.
(_sd_c): Renamed from sd_c. Take scalar parameters.
(sd_set_char_at, sd_fill): Change parameter type.
(_sd_overwrite): Renamed from sd_overwrite. Change parameter type. Take
scalar parameters.
(sd_free): Change parameter type.
* lib/string-desc-contains.c (_sd_contains): Renamed from sd_contains.
Take scalar parameters.
* lib/xstring-desc.h (xsd_new, xsd_new_filled, xsd_copy, xsd_concat):
Change return type to rw_string_desc_t.
(xsd_c): Define through a macro.
* lib/xstring-desc.c (xsd_concat): Change return type to
rw_string_desc_t.
* doc/string-desc.texi (Handling strings with NUL characters): Mention
rw_string_desc_t and the sd_readonly() function.
* lib/string-buffer.h (sb_dupfree, sb_xdupfree): Change return type to
rw_string_desc_t.
* lib/string-buffer.c (sb_contents): Add a cast to 'const char *'.
(sb_dupfree): Change return type to rw_string_desc_t.
* lib/xstring-buffer.c (sb_xdupfree): Change return type to
rw_string_desc_t.
* lib/string-buffer-reversed.h (sbr_dupfree, sbr_xdupfree): Change
return type to rw_string_desc_t.
* lib/string-buffer-reversed.c (sbr_contents): Add a cast to
'const char *'.
(sbr_dupfree): Change return type to rw_string_desc_t.
* lib/xstring-buffer-reversed.c (sbr_xdupfree): Change return type to
rw_string_desc_t.
* tests/test-string-desc.c (main): Use type rw_string_desc_t as
appropriate.
* tests/test-xstring-desc.c (main): Likewise.
* tests/test-sf-istream.c (main): Remove cast in sd_new_addr argument.
* tests/test-sfl-istream.c (main): Likewise.
* NEWS: Mention the change.

9 months agoqcopy-acl: port better to NFSv4 on GNU/Linux
Paul Eggert [Sat, 10 May 2025 01:02:29 +0000 (18:02 -0700)] 
qcopy-acl: port better to NFSv4 on GNU/Linux

Problem reported by Ian Dall in <https://bugs.gnu.org/78328>
and by Thomas Clark in <https://bugzilla.redhat.com/2363149>.
* lib/file-has-acl.c (smack_new_label_from_file) [!HAVE_SMACK]:
New dummy function.
(has_xattr, get_aclinfo): New arg FD.  All callers changed.
Remove some unnecessary MAYBE_UNUSEDs.
(acl_get_fd_np): Fall back on acl_get_fd if this function is
needed but not available.
(acl_get_fdfile): New function, if needed.
(file_has_aclinfo): Reimplement in terms of ...
(fdfile_has_aclinfo): ... this new function,
which also has an FD argument.
* lib/qcopy-acl.c [USE_XATTR]: Include dirent.h, for DT_DIR etc.
(qcopy_acl): If attr_copy_file or attr_copy_fd fail with EOPNOTSUPP,
don’t fail if the source has a trivial ACL (this is the part
that fixes the bug; the rest is optimization).
* modules/qcopy-acl (Depends-on): Depend on dirent-h and
file-has-acl if $use_xattr.  Also, depend on acl-permissions
unconditionally, since qcopy-acl.c includes acl.h unconditionally.

9 months agoHACKING: Update.
Bruno Haible [Sat, 10 May 2025 00:17:58 +0000 (02:17 +0200)] 
HACKING: Update.

* HACKING: Update for gcc 15 and clang 20.

9 months agostring-desc: Detect invalid arguments to sd_substring.
Bruno Haible [Fri, 9 May 2025 12:49:42 +0000 (14:49 +0200)] 
string-desc: Detect invalid arguments to sd_substring.

* lib/string-desc.c (sd_substring): Verify that the substring does not
extend beyond the given string.

9 months agoautoupdate
Karl Berry [Fri, 9 May 2025 15:34:41 +0000 (08:34 -0700)] 
autoupdate

9 months agonstrftime: Fix a link error on Android API level ≥ 35.
Bruno Haible [Thu, 8 May 2025 13:03:44 +0000 (15:03 +0200)] 
nstrftime: Fix a link error on Android API level ≥ 35.

Reported by Po Lu <luangruo@yahoo.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-05/msg00069.html>.

* lib/strftime.c (HAVE_ONLY_C_LOCALE): New macro.
(REQUIRE_GNUISH_STRFTIME_AM_PM): Set to false if HAVE_ONLY_C_LOCALE
is 1.
(TOUPPER): Use c_toupper if HAVE_ONLY_C_LOCALE is 1.
(c_locale_cache, c_locale): Don't define if HAVE_ONLY_C_LOCALE
&& HAVE_STRUCT_TM_TM_ZONE.
(utc_timezone_cache, utc_timezone): Don't define if
(HAVE_ONLY_C_LOCALE || (USE_C_LOCALE && !HAVE_STRFTIME_L))
&& HAVE_STRUCT_TM_TM_ZONE.
(c_weekday_names, c_month_names): Define also if HAVE_ONLY_C_LOCALE
is 1.
(underlying_strftime): Don't define if
HAVE_ONLY_C_LOCALE && HAVE_STRUCT_TM_TM_ZONE
&& !(USE_C_LOCALE && !HAVE_STRFTIME_L).
(get_tm_zone): On Android, don't return NULL.
(__strftime_internal): If HAVE_ONLY_C_LOCALE is 1, don't invoke
underlying_strftime.
* modules/nstrftime (Depends-on): Add c-ctype.

9 months agoFix some ungrammatical uses of "allows to"
Paul Eggert [Thu, 8 May 2025 07:48:56 +0000 (00:48 -0700)] 
Fix some ungrammatical uses of "allows to"

This buys back some comment changes from Emacs,
and fixes other instances I noticed.

9 months agoChangeLog fix
Paul Eggert [Thu, 8 May 2025 03:15:34 +0000 (20:15 -0700)] 
ChangeLog fix

Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2025-05/msg00096.html

9 months agoOmit a parenthesis pair again (fixing inadvertent revert)
Paul Eggert [Wed, 7 May 2025 19:07:46 +0000 (12:07 -0700)] 
Omit a parenthesis pair again (fixing inadvertent revert)

9 months agoobstack: avoid undefined pointer comparison
Paul Eggert [Wed, 7 May 2025 19:03:29 +0000 (12:03 -0700)] 
obstack: avoid undefined pointer comparison

* lib/obstack.in.h (_OBSTACK_CPTR): New macro.
(obstack_free): Use it instead of comparing pointers directly,
when the pointers might not point into the same object.

9 months agoobstack: check def before use in macros
Paul Eggert [Wed, 7 May 2025 18:20:40 +0000 (11:20 -0700)] 
obstack: check def before use in macros

* lib/obstack.in.h (__attribute_noreturn__, __extension__):
Be more careful about checking whether a macro is defined before
using it, as some compilers complain otherwise.
Simplify the logic for __extension__.

9 months agoAdd/fix some license notices.
Bruno Haible [Wed, 7 May 2025 11:32:27 +0000 (13:32 +0200)] 
Add/fix some license notices.

* lib/mcel.c: Use same license notice as lib/mcel.h.
* lib/same-inode.c: Use same license notice as lib/same-inode.h.
* lib/str_startswith.c: Change license notice to LGPLv2+.
* lib/str_endswith.c: Likewise.
* lib/hash-triple.h: Change license notice to GPL.
* lib/xstring-buffer.c: Likewise.
* lib/xstring-buffer-printf.c: Likewise.
* lib/xstring-buffer-reversed.c: Likewise.
* lib/xstring-buffer-reversed-printf.c: Likewise.

9 months agoAdd syntax-check rule against CPU predef misspellings.
Bruno Haible [Wed, 7 May 2025 09:34:47 +0000 (11:34 +0200)] 
Add syntax-check rule against CPU predef misspellings.

* lib/getloadavg.c: Test __alpha, not __alpha__.
* tests/test-snan-2.c: Likewise.
* m4/exponentd.m4: Test __arm__, not __arm.
* lib/utimensat.c: Test __hppa, not __hppa__.
* tests/qemu.h: Likewise.
* lib/fma.c: Test __sparc, not __sparc__.
* tests/qemu.h: Likewise.
* tests/test-exp2.h: Likewise.
* tests/test-nonblocking-pipe.h: Likewise.
* tests/test-snan-1.c: Likewise.
* tests/test-snan-2.c: Likewise.

9 months agoAdd syntax-check rule against OS predef misspellings.
Bruno Haible [Wed, 7 May 2025 08:56:03 +0000 (10:56 +0200)] 
Add syntax-check rule against OS predef misspellings.

* Makefile (sc_prohibit_misspelled_os_predefs): New target.
* lib/stat-size.h: Simplify detection of HP-UX.
* lib/mountlist.c: Fix typo in comment.

9 months agoAdd syntax-check rule against compiler predef misspellings.
Bruno Haible [Wed, 7 May 2025 08:52:49 +0000 (10:52 +0200)] 
Add syntax-check rule against compiler predef misspellings.

* Makefile (sc_prohibit_misspelled_compiler_predefs): New target.

9 months agoRemove obsolete syntax-check rules.
Bruno Haible [Wed, 7 May 2025 08:17:09 +0000 (10:17 +0200)] 
Remove obsolete syntax-check rules.

* Makefile (sc_maint): Comment out.
(sc_cpp_indent_check, sc_check_sym_list): Remove targets.

9 months agoFix "make sc_check_config_h_reminder" failure.
Bruno Haible [Wed, 7 May 2025 07:47:49 +0000 (09:47 +0200)] 
Fix "make sc_check_config_h_reminder" failure.

* Makefile (config_h_MACROS2): Add _GL_ATTRIBUTE_DEALLOC_FREE,
_GL_ATTRIBUTE_NONNULL_IF_NONZERO, _GL_ATTRIBUTE_REPRODUCIBLE,
_GL_ATTRIBUTE_UNSEQUENCED, _GL_ATTRIBUTE_CAPABILITY_TYPE,
_GL_ATTRIBUTE_ACQUIRE_CAPABILITY, _GL_ATTRIBUTE_RELEASE_CAPABILITY.
(exclude_file_name_regexp--sc_check_config_h_reminder): New variable.
(sc_check_config_h_reminder): Use it.
* lib/areadlink.h: Add <config.h> reminder.
* lib/crc.h: Likewise.
* lib/crc-x86_64.h: Likewise.
* lib/diffseq.h: Likewise.
* lib/gl_sublist.h: Likewise.
* lib/signed-nan.h: Likewise.
* lib/signed-snan.h: Likewise.
* lib/snan.h: Likewise.
* lib/unicase/special-casing.in.h: Likewise.

9 months agoTidy "make sc_prohibit_AC_LIBOBJ_in_m4" check.
Bruno Haible [Wed, 7 May 2025 07:24:30 +0000 (09:24 +0200)] 
Tidy "make sc_prohibit_AC_LIBOBJ_in_m4" check.

* Makefile (sc_prohibit_AC_LIBOBJ_in_m4): Don't hide the rule commands.
(allow_AC_LIBOBJ): Remove exceptions that are no longer needed.

9 months agoobstack: omit a parenthesis pair
Paul Eggert [Wed, 7 May 2025 07:17:47 +0000 (00:17 -0700)] 
obstack: omit a parenthesis pair

* lib/obstack.in.h (obstack_free) [!__GNUC__]:
Omit an unnecessary pair of parentheses that are
also omitted in glibc.

9 months agoFix "make sc_prohibit_sc_omitted_at" failure.
Bruno Haible [Wed, 7 May 2025 07:12:36 +0000 (09:12 +0200)] 
Fix "make sc_prohibit_sc_omitted_at" failure.

* Makefile (sc_prohibit_sc_omitted_at): Don't apply to this Makefile.
(sc_*): Don't hide the rule commands.

9 months agoFix "make sc_prefer_ac_check_funcs_once" failure.
Bruno Haible [Wed, 7 May 2025 07:05:02 +0000 (09:05 +0200)] 
Fix "make sc_prefer_ac_check_funcs_once" failure.

* Makefile (exclude_file_name_regexp--sc_prefer_ac_check_funcs_once):
New variable.
(sc_prefer_ac_check_funcs_once): Use it.

9 months agoFix "make sc_prohibit_leading_TABs" failures.
Bruno Haible [Wed, 7 May 2025 06:57:31 +0000 (08:57 +0200)] 
Fix "make sc_prohibit_leading_TABs" failures.

* Makefile (exclude_file_name_regexp--sc_prohibit_leading_TABs): New
variable.
(sc_prohibit_leading_TABs): Use it.
* lib/crc-x86_64-pclmul.c: Untabify.
* tests/test-crc.c: Untabify.
* tests/test-parse-duration.sh: Remove leading tabs from here documents.

9 months agostddef-h: Fix __GNUC_MINOR__ typo.
Collin Funk [Wed, 7 May 2025 03:06:31 +0000 (20:06 -0700)] 
stddef-h: Fix __GNUC_MINOR__ typo.

* m4/stddef_h.m4 (gl_STDDEF_H): Use __GNUC_MINOR__ instead of
__GNUC_MINOR.

9 months agoobstack: fix comment
Paul Eggert [Tue, 6 May 2025 22:14:50 +0000 (15:14 -0700)] 
obstack: fix comment

* lib/obstack.c: Fix comment along the lines suggested
by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2025-05/msg00074.html

9 months agoobstack: let glibc user #define __obstack_free
Paul Eggert [Tue, 6 May 2025 22:09:02 +0000 (15:09 -0700)] 
obstack: let glibc user #define __obstack_free

* lib/obstack.in.h (__obstack_free)
[! (__GL_GNULIB_HEADER && __GL_REPLACE_OBSTACK__)]:
Allow glibc user to #define __obstack_free.  Although this
vestigial feature is not useful any more, it is one less change to
current glibc usage and so should make it a bit easier to merge
with glibc.

9 months agoobstack: don’t assume INT_MAX < SIZE_MAX
Paul Eggert [Tue, 6 May 2025 21:57:40 +0000 (14:57 -0700)] 
obstack: don’t assume INT_MAX < SIZE_MAX

This for clarity and to document the overflow checking better;
I think no current Gnulib or glibc targets have SIZE_MAX <= INTMAX,
so it shouldn’t change behavior on current targets.
* lib/obstack.c: Include stdckdint.h, not limits.h.
Remove no-longer needed ! (SIZE_MAX <= INT_MAX) check.
(align_chunk_size_up): Rename from align_size_up,
and change API to detect overflow directly.  All callers changed.
(align_chunk_size_up, _obstack_newchunk): Use ckd_add instead of
checking overflow by hand in a way that assumed INT_MAX < SIZE_MAX.
(call_chunkfun, _obstack_begin_worker, _obstack_newchunk):
Accept and use _OBSTACK_CHUNK_SIZE_T not size_t.  This affects
only glibc, since the two types are the same in Gnulib.  All
callers changed.
* modules/obstack (Depends-on): Add stdckdint-h.

9 months agoobstack: Fix library namespacing (regression yesterday).
Bruno Haible [Tue, 6 May 2025 17:52:10 +0000 (19:52 +0200)] 
obstack: Fix library namespacing (regression yesterday).

* lib/obstack.in.h (__obstack_free): Define to _obstack_free, not
obstack_free, within glibc and in gnulib on systems without glibc.
* lib/obstack.c (obstack_free): Undefine only for the strong_alias.
(obstack_free): Define as an alias of _obstack_free, not vice versa.

9 months agoobstack: match obstack.c with glibc
Paul Eggert [Mon, 5 May 2025 21:02:21 +0000 (14:02 -0700)] 
obstack: match obstack.c with glibc

Make this file easier to compare with glibc obstack.c.
* lib/obstack.c: Include shlib-compat.h or libc-config.h.
Move some !_OBSTACK_NO_ERROR_HANDLER declarations up.
Add _LIBC-only compatibility decls.
* modules/obstack (Depends-on): Add libc-config.

9 months agoobstack: simplify default size, alignment
Paul Eggert [Mon, 5 May 2025 21:02:21 +0000 (14:02 -0700)] 
obstack: simplify default size, alignment

* lib/obstack.c (MAX, DEFAULT_ALIGNMENT, DEFAULT_ROUNDING): Remove.
(_obstack_begin_worker): Use __alignof__ (max_align_t)
instead of calculating it by hand, possibly incorrectly
on oddball platforms.  Estimate a good size of 4000 bytes
rather than using a no-longer-valid value.
* modules/obstack (Depends-on): Add stddef-h, for max_align_t.

9 months agoobstack: use signed chunk sizes
Paul Eggert [Mon, 5 May 2025 21:02:20 +0000 (14:02 -0700)] 
obstack: use signed chunk sizes

* lib/obstack.in.h (_OBSTACK_CHUNK_SIZE_T) [!__GL_GNULIB_HEADER]:
Now long, not unsigned long, since that’s what glibc does.

9 months agoobstack: fix undefined behavior if big alignment
Paul Eggert [Mon, 5 May 2025 21:02:19 +0000 (14:02 -0700)] 
obstack: fix undefined behavior if big alignment

* lib/obstack.c: Include stddef.h, for offsetof.
(align_size_up): New static function.
(_obstack_begin_worker, _obstack_newchunk):
Ensure that the chunk limit is aligned, too.
(_obstack_begin_worker): Don’t assume that 4096 is large enough,
as the alignment could be larger.
* lib/obstack.in.h (obstack_finish): Remove code that could have
set next_free outside the limits of the allocated storage, which
had undefined behavior.  This code is no longer needed now that
chunk_limit has proper alignment.

9 months agolibc-config, obstack: Oracle __extension__ support
Paul Eggert [Mon, 5 May 2025 21:02:19 +0000 (14:02 -0700)] 
libc-config, obstack: Oracle __extension__ support

* lib/cdefs.h, lib/obstack.in.h (__extension__):
Oracle Developer Studio 12.6 also supports __extension__.

9 months agoobstack: be more like glibc for __extension__
Paul Eggert [Mon, 5 May 2025 21:02:18 +0000 (14:02 -0700)] 
obstack: be more like glibc for __extension__

* lib/obstack.in.h (__extension__): Use glibc-like syntax
for testing gcc version.

9 months agoobstack: be more like glibc in return values
Paul Eggert [Mon, 5 May 2025 21:02:17 +0000 (14:02 -0700)] 
obstack: be more like glibc in return values

This partly reverts commit d15b2da0ac25e085ce30a9e2672624999ce910a6
dated 2014-11-03.  It keeps the part of that commit that fixed the
return type of non-gcc versions of obstack_make_room,
obstack_grow, obstack_grow0, obstack_1grow, obstack_ptr_grow_fast,
obstack_int_grow_fast, obstack_blank so that they agree with gcc
versions.
* lib/obstack.in.h (obstack_next_free, obstack_chunkfun)
(obstack_freefun, obstack_1grow_fast, obstack_blank_fast):
Go back to returning a value instead of void,
to allay any glibc concerns about compatibility.
(obstack_1grow, obstack_blank): Explicitly return void,
since callees no longer do so.

9 months agoobstack: _obstack_free → __obstack_free
Paul Eggert [Mon, 5 May 2025 21:02:17 +0000 (14:02 -0700)] 
obstack: _obstack_free → __obstack_free

* lib/obstack.in.h (__obstack_free): Rename back from _obstack_free.
This is for compatibility with glibc, which in turn is for
compatibility with old Gnulib.  All uses changed.

9 months agoobstack: use glibc’s temp slot names
Paul Eggert [Mon, 5 May 2025 21:02:16 +0000 (14:02 -0700)] 
obstack: use glibc’s temp slot names

* lib/obstack.in.h (struct obstack): Rename temp fields back to
what glibc uses, to avoid any glibc concerns about source code
compatibility.  All uses changed back.  This affect only
non-GNU-compatible compilers.

9 months ago* lib/obstack.in.h: Move <string.h> include.
Paul Eggert [Mon, 5 May 2025 21:02:15 +0000 (14:02 -0700)] 
* lib/obstack.in.h: Move <string.h> include.

This is merely to make the glibc reviewer’s job easier,
since the include location doesn’t matter.

9 months agoobstack: size_t → _OBSTACK_CHUNK_SIZE_T
Paul Eggert [Mon, 5 May 2025 21:02:15 +0000 (14:02 -0700)] 
obstack: size_t → _OBSTACK_CHUNK_SIZE_T

* lib/obstack.c (_obstack_begin, _obstack_begin_1):
* lib/obstack.in.h (struct obstack, obstack_init, obstack_begin)
(obstack_specify_allocation)
(obstack_specify_allocation_with_arg, obstack_chunkfun):
Use _OBSTACK_CHUNK_SIZE_T instead of size_t in places where
glibc uses unsigned long rather than size_t.  This makes
no difference with Gnulib, but should help allay any concerns
that merging Gnulib with glibc might change glibc’s ABI
on obsolescent glibc platforms where size_t is unsigned int.

9 months agoobstack: rename to _OBSTACK_CHUNK_SIZE_T
Paul Eggert [Mon, 5 May 2025 21:02:15 +0000 (14:02 -0700)] 
obstack: rename to _OBSTACK_CHUNK_SIZE_T

* lib/obstack.in.h (_OBSTACK_CHUNK_SIZE_T):
Rename from _CHUNK_SIZE_T, for namespace prefix consistency.

9 months agoobstack: use int where glibc does
Paul Eggert [Mon, 5 May 2025 21:02:14 +0000 (14:02 -0700)] 
obstack: use int where glibc does

Make it easier to merge with glibc, by using int where
the glibc API uses int, when compiling for glibc.
This does not affect Gnulib behavior.
* lib/obstack.in.h (_OBSTACK_INDEX_T): New macro.
* lib/obstack.in.h (struct obstack):
* lib/obstack.c (_obstack_begin_worker, obstack_begin)
(_obstack_begin_1, _obstack_newchunk, _obstack_memory_used):
Use _OBSTACK_INDEX_T, not _OBSTACK_SIZE_T, for API components
where glibc uses int.

9 months agoobstack: use presence of uintptr_t
Paul Eggert [Mon, 5 May 2025 21:02:13 +0000 (14:02 -0700)] 
obstack: use presence of uintptr_t

The code depends on the presence of uintptr_t,
not on whether ptrdiff_t is narrower than a pointer,
so use C macros that reflect this.
Also, clean up the namespace in the typical GCC-like case
* lib/obstack.in.h (_OBSTACK_UINTPTR_TYPE): New macro.
Include <stdint.h> only if needed (i.e., not GCC-like).
(__PTR_ALIGN): Use new macro instead of relying on
__GL_SMALL_PTRDIFF_T__ and directly on uintptr_t.
* m4/obstack.m4 (gl_FUNC_OBSTACK): Simplify by removing
__GL_SMALL_PTRDIFF_T__.

9 months agoobstack: define PTR_INT_TYPE
Paul Eggert [Mon, 5 May 2025 21:02:13 +0000 (14:02 -0700)] 
obstack: define PTR_INT_TYPE

* lib/obstack.in.h (PTR_INT_TYPE): Define, for compatibility
with glibc even though we don’t need the type for anything
other than compatibility.  Include stddef.h only if needed,
like glibc obstack.h does.

9 months agoobstack: change license wording
Paul Eggert [Mon, 5 May 2025 21:02:12 +0000 (14:02 -0700)] 
obstack: change license wording

Change license wording to match glibc, to ease future merging.

9 months agoobstack: merge better with glibc
Paul Eggert [Mon, 5 May 2025 21:02:12 +0000 (14:02 -0700)] 
obstack: merge better with glibc

When compiled for glibc, keep the fake array content size at 4,
for API compatibility with older glibc.
* lib/obstack.in.h (__FLEXIBLE_ARRAY_MEMBER): Remove.
(_OBSTACK_CHUNK_CONTENTS_SIZE): New macro.
(struct _obstack_chunk): Use it for contents size.
* modules/obstack (Depends-on): Add flexmember.

9 months agoobstack: stop depending on alignof
Paul Eggert [Mon, 5 May 2025 21:01:54 +0000 (14:01 -0700)] 
obstack: stop depending on alignof

* lib/obstack.c (__alignof__) [!__GNUC__]:
Default to alignof, not to alignof_type.
* modules/obstack (Depends-on): Depend on alignasof directly,
not indirectly via alignof.

9 months agoobstack: fix unlikely buffer overrun in glibc
Paul Eggert [Mon, 5 May 2025 21:00:32 +0000 (14:00 -0700)] 
obstack: fix unlikely buffer overrun in glibc

This bug is not plausible on any Gnulib platform,
but it could happen in glibc if the requested size is UINT_MAX.
* lib/obstack.c (_obstack_newchunk): Fail if requested size is 0.
* lib/obstack.in.h (obstack_grow0): Check for room <= len,
not room <= len + 1 where len + 1 could overflow.

9 months agowindows-cygpath: Make it work with the native Windows 'git' port.
Bruno Haible [Mon, 5 May 2025 17:02:01 +0000 (19:02 +0200)] 
windows-cygpath: Make it work with the native Windows 'git' port.

* lib/windows-cygpath.c (windows_cygpath_w): When we don't invoke
cygpath, still convert slashes to backslashes.

9 months agovc-mtime: Another fix for native Windows.
Bruno Haible [Mon, 5 May 2025 12:58:51 +0000 (14:58 +0200)] 
vc-mtime: Another fix for native Windows.

* lib/vc-mtime.c (SLASH): New macro.
(max_vc_mtime): Use it as expected directory separator in canonicalized
file names.

9 months agovc-mtime: Make it work with Cygwin's 'git' command on native Windows.
Bruno Haible [Mon, 5 May 2025 09:40:06 +0000 (11:40 +0200)] 
vc-mtime: Make it work with Cygwin's 'git' command on native Windows.

* lib/vc-mtime.c: Include windows-cygpath.h.
(abs_git_checkout): Invoke windows_cygpath_w.
* modules/vc-mtime (Depends-on): Add windows-cygpath.

9 months agoNew module windows-cygpath.
Bruno Haible [Mon, 5 May 2025 09:37:16 +0000 (11:37 +0200)] 
New module windows-cygpath.

* lib/windows-cygpath.h: New file, based on lib/cygpath.h.
* lib/windows-cygpath.c: New file, based on lib/cygpath.c.
* modules/windows-cygpath: New file.

9 months agoobstack: Relicense under LGPLv2+.
Bruno Haible [Mon, 5 May 2025 09:32:23 +0000 (11:32 +0200)] 
obstack: Relicense under LGPLv2+.

Alan Modra's permission is at
<https://lists.gnu.org/archive/html/bug-gnulib/2025-05/msg00042.html>.
Paul Eggert's permission is at
<https://lists.gnu.org/archive/html/bug-gnulib/2025-05/msg00041.html>.

* modules/obstack (License): Change to LGPLv2+.
* lib/obstack.in.h: Update license notice.
* lib/obstack.c: Likewise.

9 months agocrypto/gc-arcfour tests: Fix link error when using --with-libgcrypt.
Collin Funk [Mon, 5 May 2025 01:06:02 +0000 (18:06 -0700)] 
crypto/gc-arcfour tests: Fix link error when using --with-libgcrypt.

* modules/crypto/gc-arcfour-tests (Makefile.am): Link the test program
to @LIB_CRYPTO@.

9 months agosockets: Fix typo in comment.
Bruno Haible [Mon, 5 May 2025 00:38:22 +0000 (02:38 +0200)] 
sockets: Fix typo in comment.

* lib/sockets.h: Fix a typo in comment.

9 months agocrypto/gc: Silence some -Wcalloc-transposed-args warnings, part 2.
Collin Funk [Mon, 5 May 2025 00:19:56 +0000 (17:19 -0700)] 
crypto/gc: Silence some -Wcalloc-transposed-args warnings, part 2.

* lib/gc-libgcrypt.c (gc_hash_open, gc_hash_clone): Swap the arguments
to calloc().

9 months agogetlocalename_l-unsafe: Improve support for Solaris 11 OpenIndiana.
Bruno Haible [Sun, 4 May 2025 16:25:53 +0000 (18:25 +0200)] 
getlocalename_l-unsafe: Improve support for Solaris 11 OpenIndiana.

Suggested by Andy Fiddaman <illumos@fiddaman.net> in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-05/msg00018.html>.

* lib/getlocalename_l-unsafe.c (getlocalename_l_unsafe): On Solaris, use
the system's getlocalename_l() function if available.

9 months agovc-mtime: Don't crash if xgetcwd() returns NULL.
Bruno Haible [Sun, 4 May 2025 16:22:31 +0000 (18:22 +0200)] 
vc-mtime: Don't crash if xgetcwd() returns NULL.

* lib/vc-mtime.c (max_vc_mtime): Skip the git processing if xgetcwd()
returns NULL.

9 months agovc-mtime: Fix a buffer overflow.
Bruno Haible [Sun, 4 May 2025 16:21:01 +0000 (18:21 +0200)] 
vc-mtime: Fix a buffer overflow.

* lib/vc-mtime.c (max_vc_mtime): Increase the size of argv by one
element.

9 months agogetlocalename_l-unsafe: Fix typo in comment.
Bruno Haible [Sat, 3 May 2025 14:46:26 +0000 (16:46 +0200)] 
getlocalename_l-unsafe: Fix typo in comment.

* lib/getlocalename_l-unsafe.h (struct string_with_storage): Fix
comment.

9 months agohavelib: Fix m4 underquoting bug in AC_LIB_FROMPACKAGE.
Bruno Haible [Sun, 4 May 2025 06:19:44 +0000 (08:19 +0200)] 
havelib: Fix m4 underquoting bug in AC_LIB_FROMPACKAGE.

Reported for GNU clisp by Adam Sampson <ats@offog.org> at
<https://gitlab.com/gnu-clisp/clisp/-/issues/60>.

* m4/lib-link.m4 (AC_LIB_FROMPACKAGE): Protect the comma in the
expansion of [acl_libsinpackage_]PACKUP by one more level of quotes.

9 months agotests: Avoid compilation errors on GNU/kFreeBSD.
Bruno Haible [Sat, 3 May 2025 10:27:53 +0000 (12:27 +0200)] 
tests: Avoid compilation errors on GNU/kFreeBSD.

* tests/test-sys_stat-h.c: Disable blksize_t assertion on GNU/kFreeBSD.
* tests/test-sys_types-h.c: Likewise.

9 months agodoc: Update documentation for 'open' errno discrepancies.
Collin Funk [Sat, 3 May 2025 03:33:56 +0000 (20:33 -0700)] 
doc: Update documentation for 'open' errno discrepancies.

* doc/posix-functions/open.texi: Document that NetBSD 10.0 and FreeBSD
14.2 set errno differently than POSIX specifies for
'open ("symlink", O_NOFOLLOW ...)'.

9 months agovc-mtime: Make it work with git versions < 2.28.
Bruno Haible [Fri, 2 May 2025 10:09:40 +0000 (12:09 +0200)] 
vc-mtime: Make it work with git versions < 2.28.

* lib/vc-mtime.c (git_version): New variable.
(is_git_present): Read the output of "git --version", and set
git_version.
(max_vc_mtime): Don't pass option --no-relative if the git version
is < 2.28.

9 months agovc-mtime: Add API for more efficient use of git, part 2.
Bruno Haible [Fri, 2 May 2025 00:43:23 +0000 (02:43 +0200)] 
vc-mtime: Add API for more efficient use of git, part 2.

* lib/vc-mtime.c (max_vc_mtime): Don't skip the odd-numbered arguments.

9 months agodoc: Clarify age of <sys/types.h>.
G. Branden Robinson [Thu, 1 May 2025 23:06:18 +0000 (01:06 +0200)] 
doc: Clarify age of <sys/types.h>.

* doc/gnulib-readme.texi (C language versions): Mention when
<sys/types.h> first appeared.

Copyright-paperwork-exempt: Yes

9 months agovc-mtime: Add API for more efficient use of git.
Bruno Haible [Thu, 1 May 2025 15:26:27 +0000 (17:26 +0200)] 
vc-mtime: Add API for more efficient use of git.

Reported by Serhii Tereshchenko, Arthur, Adam YS, Foucauld Degeorges
at <https://savannah.gnu.org/bugs/?66865>.

* lib/vc-mtime.h (max_vc_mtime): New declaration.
* lib/vc-mtime.c: Include <errno.h>, <stdio.h>, <string.h>, filename.h,
xalloc.h, xgetcwd.h, xvasprintf.h, gl_map.h, gl_xmap.h, gl_hash_map.h,
hashkey-string.h, unlocked-io.h.
(is_git_present): New function, extracted from vc_mtime.
(vc_mtime): Invoke it.
(MAX_COMMAND_LENGTH, MAX_CMD_LEN): New macros.
(abs_git_checkout): New function, based on execute_and_read_line in
lib/javacomp.c.
(ancestor_level, relativize): New functions.
(struct accumulator): New type.
(accumulate): New function.
(max_vc_mtime): New function.
(test_ancestor_level, test_relativize, main) [TEST]: New functions.
* modules/vc-mtime (Depends-on): Add filename, xalloc, xgetcwd,
canonicalize-lgpl, xvasprintf, str_startswith, map, xmap, hash-map,
hashkey-string, getdelim.

9 months agojavacomp: Fix resource leak.
Bruno Haible [Thu, 1 May 2025 15:28:06 +0000 (17:28 +0200)] 
javacomp: Fix resource leak.

* lib/javacomp.c (execute_and_read_line): Upon failure, close the stream
and wait for the child process to terminate.

9 months agoNew module hashcode-string1.
Bruno Haible [Wed, 30 Apr 2025 10:47:37 +0000 (12:47 +0200)] 
New module hashcode-string1.

* lib/hashcode-string1.h: New file.
* lib/hashcode-string1.c: New file, based on lib/hash.c.
* modules/hashcode-string1: New file.
* lib/hash.h: Include hashcode-string1.h.
(hash_string): Remove declaration.
* lib/hash.c (hash_string): Remove function.
* modules/hash (Depends-on): Add hashcode-string1.
* lib/exclude.c: Include hashcode-string1.h.
* modules/exclude (Depends-on): Add hashcode-string1.

9 months agoRename module hashcode-string to hashcode-string2.
Bruno Haible [Wed, 30 Apr 2025 10:28:42 +0000 (12:28 +0200)] 
Rename module hashcode-string to hashcode-string2.

* lib/hashcode-string2.h: Renamed from lib/hashcode-string.h.
* lib/hashcode-string2.c: Renamed from lib/hashcode-string.c.
* modules/hashcode-string2: Renamed from modules/hashcode-string.
* MODULES.html.sh: Update.
* top/maint.mk: Update.
* lib/hash-pjw.h: Update.
* modules/hash-pjw: Update.
* lib/hashcode-named-file.c: Update.
* modules/hashcode-named-file (Depends-on): Update.
* tests/test-hash.c: Update.
* modules/hash-tests (Depends-on): Update.

9 months agoclean-temp: Fix link error (regression yesterday).
Bruno Haible [Wed, 30 Apr 2025 11:11:01 +0000 (13:11 +0200)] 
clean-temp: Fix link error (regression yesterday).

* lib/clean-temp.c: Include hashkey-string.h.
(create_temp_dir): Use hashkey_string_* functions instead of
clean_temp_string_*.
* lib/clean-temp-private.h (clean_temp_string_equals,
clean_temp_string_hash): Remove declarations.
* modules/clean-temp (Depends-on): Add hashkey-string.

9 months agohashcode-named-file: Fix mistake (regression yesterday).
Bruno Haible [Wed, 30 Apr 2025 10:24:49 +0000 (12:24 +0200)] 
hashcode-named-file: Fix mistake (regression yesterday).

* lib/hash-triple.h: Include the correct header.

9 months agoobstack: Make it easier to sync back with glibc.
Bruno Haible [Wed, 30 Apr 2025 09:57:34 +0000 (11:57 +0200)] 
obstack: Make it easier to sync back with glibc.

* lib/obstack.in.h: Use __GL_GNULIB_HEADER to delimit sections that are
for Gnulib usage.
Test __GL_SMALL_PTRDIFF_T__ instead of @SMALL_PTRDIFF_T@.
Test __GL_REPLACE_OBSTACK__ instead of @REPLACE_OBSTACK@.
* modules/obstack (Makefile.am): Substitute __GL_GNULIB_HEADER.
Substitute __GL_SMALL_PTRDIFF_T__ instead of @SMALL_PTRDIFF_T@.
Substitute __GL_REPLACE_OBSTACK__ instead of @REPLACE_OBSTACK@.

9 months agohash: Rename an internal function.
Bruno Haible [Wed, 30 Apr 2025 01:31:00 +0000 (03:31 +0200)] 
hash: Rename an internal function.

* lib/hash.c (find_entry): Rename from hash_find_entry.

9 months agoNew module mem-hash-map.
Bruno Haible [Wed, 30 Apr 2025 01:19:10 +0000 (03:19 +0200)] 
New module mem-hash-map.

* lib/mem-hash-map.h: New file, from GNU gettext.
* lib/mem-hash-map.c: New file, from GNU gettext.
* modules/mem-hash-map: New file, from GNU gettext.

9 months agonext-prime: Add tests.
Bruno Haible [Wed, 30 Apr 2025 00:50:58 +0000 (02:50 +0200)] 
next-prime: Add tests.

* tests/test-next-prime.c: New file.
* modules/next-prime-tests: New file.

9 months agoNew module next-prime.
Bruno Haible [Tue, 29 Apr 2025 23:52:17 +0000 (01:52 +0200)] 
New module next-prime.

* lib/next-prime.h: New file, based on lib/hash.c.
* lib/next-prime.c: New file, based on lib/hash.c.
* modules/next-prime: New file.
* lib/hash.c: Include next-prime.h.
(is_prime, next_prime): Remove functions.
* modules/hash (Depends-on): Add next-prime.

9 months agoNew module hashkey-string.
Bruno Haible [Tue, 29 Apr 2025 23:20:17 +0000 (01:20 +0200)] 
New module hashkey-string.

* lib/hashkey-string.h: New file.
* lib/hashkey-string.c: New file, based on lib/clean-temp-simple.c.
* modules/hashkey-string: New file.
* lib/clean-temp-simple.c: Include hashkey-string.h. Don't include
<limits.h>.
(clean_temp_string_equals, clean_temp_string_hash): Remove functions.
(SIZE_BITS): Remove macro.
(register_temporary_file): Use hashkey_string_equals and
hashkey_string_hash.
* modules/clean-temp-simple (Depends-on): Add hashkey-string.

9 months agoRename include file hash-triple.h to hashcode-file.h.
Bruno Haible [Tue, 29 Apr 2025 22:46:21 +0000 (00:46 +0200)] 
Rename include file hash-triple.h to hashcode-file.h.

* lib/hashcode-file.h: Renamed from lib/hash-triple.h.
* lib/hash-triple.h: New file.
* lib/hashcode-named-file.c: Update.
* lib/hashcode-file-inode.c: Update.
* lib/canonicalize.c: Update.
* lib/file-set.c: Update.
* modules/hashcode-named-file (Files, Include): Update.
* modules/hashcode-file-inode (Include): Update.
* modules/hash-triple (Include): Update.

9 months agoRename module hash-triple to hashcode-file-inode.
Bruno Haible [Tue, 29 Apr 2025 22:37:08 +0000 (00:37 +0200)] 
Rename module hash-triple to hashcode-file-inode.

* lib/hashcode-file-inode.c: Renamed from lib/hash-triple.c.
* modules/hashcode-file-inode: Renamed from modules/hash-triple.
* modules/hash-triple: New file.
* lib/hash-triple.h: Update.
* MODULES.html.sh: Update.