Update from Gnulib by running admin/merge-gnulib
* admin/merge-gnulib (GNULIB_MODULES): Add memeq, streq and remove stringeq, to adjust to a module splitup in Gnulib. * lib/memeq.c, lib/streq.c, lib/strnul.c, m4/memeq.m4, m4/streq.m4: New files. * lib/string.c, m4/stringeq.m4: Remove.
This commit is contained in:
@@ -43,7 +43,7 @@ GNULIB_MODULES='
|
|||||||
free-posix fstatat fsusage fsync futimens
|
free-posix fstatat fsusage fsync futimens
|
||||||
getline getloadavg getopt-gnu getrandom gettime gettimeofday gitlog-to-changelog
|
getline getloadavg getopt-gnu getrandom gettime gettimeofday gitlog-to-changelog
|
||||||
ieee754-h ignore-value intprops largefile libgmp lstat
|
ieee754-h ignore-value intprops largefile libgmp lstat
|
||||||
malloc-gnu manywarnings memmem-simple mempcpy memrchr memset_explicit
|
malloc-gnu manywarnings memeq memmem-simple mempcpy memrchr memset_explicit
|
||||||
minmax mkostemp mktime
|
minmax mkostemp mktime
|
||||||
nanosleep nproc nstrftime-limited
|
nanosleep nproc nstrftime-limited
|
||||||
pathmax pipe2 pselect pthread_sigmask
|
pathmax pipe2 pselect pthread_sigmask
|
||||||
@@ -51,7 +51,7 @@ GNULIB_MODULES='
|
|||||||
sig2str sigdescr_np socklen stat-time std-gnu23
|
sig2str sigdescr_np socklen stat-time std-gnu23
|
||||||
stdc_bit_width stdc_count_ones stdc_trailing_zeros
|
stdc_bit_width stdc_count_ones stdc_trailing_zeros
|
||||||
stdckdint-h stddef-h stdio-h stdio-windows
|
stdckdint-h stddef-h stdio-h stdio-windows
|
||||||
stpcpy stringeq strnlen strtoimax symlink sys_stat-h sys_time-h
|
stpcpy streq strnlen strtoimax symlink sys_stat-h sys_time-h
|
||||||
tempname time-h time_r time_rz timegm timer-time timespec-add timespec-sub
|
tempname time-h time_r time_rz timegm timer-time timespec-add timespec-sub
|
||||||
unlocked-io update-copyright utimensat
|
unlocked-io update-copyright utimensat
|
||||||
warnings year2038
|
warnings year2038
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ aclinfo_has_xattr (struct aclinfo const *ai, char const *xattr)
|
|||||||
if (0 < ai->size)
|
if (0 < ai->size)
|
||||||
{
|
{
|
||||||
char const *blim = ai->buf + ai->size;
|
char const *blim = ai->buf + ai->size;
|
||||||
for (char const *b = ai->buf; b < blim; b += strlen (b) + 1)
|
for (char const *b = ai->buf; b < blim; b = strnul (b) + 1)
|
||||||
for (char const *a = xattr; *a == *b; a++, b++)
|
for (char const *a = xattr; *a == *b; a++, b++)
|
||||||
if (!*a)
|
if (!*a)
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -140,6 +140,7 @@
|
|||||||
# lstat \
|
# lstat \
|
||||||
# malloc-gnu \
|
# malloc-gnu \
|
||||||
# manywarnings \
|
# manywarnings \
|
||||||
|
# memeq \
|
||||||
# memmem-simple \
|
# memmem-simple \
|
||||||
# mempcpy \
|
# mempcpy \
|
||||||
# memrchr \
|
# memrchr \
|
||||||
@@ -172,7 +173,7 @@
|
|||||||
# stdio-h \
|
# stdio-h \
|
||||||
# stdio-windows \
|
# stdio-windows \
|
||||||
# stpcpy \
|
# stpcpy \
|
||||||
# stringeq \
|
# streq \
|
||||||
# strnlen \
|
# strnlen \
|
||||||
# strtoimax \
|
# strtoimax \
|
||||||
# symlink \
|
# symlink \
|
||||||
@@ -537,6 +538,7 @@ GL_GNULIB_MDA_UMASK = @GL_GNULIB_MDA_UMASK@
|
|||||||
GL_GNULIB_MDA_UNLINK = @GL_GNULIB_MDA_UNLINK@
|
GL_GNULIB_MDA_UNLINK = @GL_GNULIB_MDA_UNLINK@
|
||||||
GL_GNULIB_MDA_WRITE = @GL_GNULIB_MDA_WRITE@
|
GL_GNULIB_MDA_WRITE = @GL_GNULIB_MDA_WRITE@
|
||||||
GL_GNULIB_MEMCHR = @GL_GNULIB_MEMCHR@
|
GL_GNULIB_MEMCHR = @GL_GNULIB_MEMCHR@
|
||||||
|
GL_GNULIB_MEMEQ = @GL_GNULIB_MEMEQ@
|
||||||
GL_GNULIB_MEMMEM = @GL_GNULIB_MEMMEM@
|
GL_GNULIB_MEMMEM = @GL_GNULIB_MEMMEM@
|
||||||
GL_GNULIB_MEMPCPY = @GL_GNULIB_MEMPCPY@
|
GL_GNULIB_MEMPCPY = @GL_GNULIB_MEMPCPY@
|
||||||
GL_GNULIB_MEMRCHR = @GL_GNULIB_MEMRCHR@
|
GL_GNULIB_MEMRCHR = @GL_GNULIB_MEMRCHR@
|
||||||
@@ -626,12 +628,12 @@ GL_GNULIB_STPNCPY = @GL_GNULIB_STPNCPY@
|
|||||||
GL_GNULIB_STRCASESTR = @GL_GNULIB_STRCASESTR@
|
GL_GNULIB_STRCASESTR = @GL_GNULIB_STRCASESTR@
|
||||||
GL_GNULIB_STRCHRNUL = @GL_GNULIB_STRCHRNUL@
|
GL_GNULIB_STRCHRNUL = @GL_GNULIB_STRCHRNUL@
|
||||||
GL_GNULIB_STRDUP = @GL_GNULIB_STRDUP@
|
GL_GNULIB_STRDUP = @GL_GNULIB_STRDUP@
|
||||||
|
GL_GNULIB_STREQ = @GL_GNULIB_STREQ@
|
||||||
GL_GNULIB_STRERROR = @GL_GNULIB_STRERROR@
|
GL_GNULIB_STRERROR = @GL_GNULIB_STRERROR@
|
||||||
GL_GNULIB_STRERRORNAME_NP = @GL_GNULIB_STRERRORNAME_NP@
|
GL_GNULIB_STRERRORNAME_NP = @GL_GNULIB_STRERRORNAME_NP@
|
||||||
GL_GNULIB_STRERROR_L = @GL_GNULIB_STRERROR_L@
|
GL_GNULIB_STRERROR_L = @GL_GNULIB_STRERROR_L@
|
||||||
GL_GNULIB_STRERROR_R = @GL_GNULIB_STRERROR_R@
|
GL_GNULIB_STRERROR_R = @GL_GNULIB_STRERROR_R@
|
||||||
GL_GNULIB_STRFTIME = @GL_GNULIB_STRFTIME@
|
GL_GNULIB_STRFTIME = @GL_GNULIB_STRFTIME@
|
||||||
GL_GNULIB_STRINGEQ = @GL_GNULIB_STRINGEQ@
|
|
||||||
GL_GNULIB_STRNCAT = @GL_GNULIB_STRNCAT@
|
GL_GNULIB_STRNCAT = @GL_GNULIB_STRNCAT@
|
||||||
GL_GNULIB_STRNCPY = @GL_GNULIB_STRNCPY@
|
GL_GNULIB_STRNCPY = @GL_GNULIB_STRNCPY@
|
||||||
GL_GNULIB_STRNDUP = @GL_GNULIB_STRNDUP@
|
GL_GNULIB_STRNDUP = @GL_GNULIB_STRNDUP@
|
||||||
@@ -2790,6 +2792,14 @@ EXTRA_libgnu_a_SOURCES += malloc.c
|
|||||||
endif
|
endif
|
||||||
## end gnulib module malloc-posix
|
## end gnulib module malloc-posix
|
||||||
|
|
||||||
|
## begin gnulib module memeq
|
||||||
|
ifeq (,$(OMIT_GNULIB_MODULE_memeq))
|
||||||
|
|
||||||
|
libgnu_a_SOURCES += memeq.c
|
||||||
|
|
||||||
|
endif
|
||||||
|
## end gnulib module memeq
|
||||||
|
|
||||||
## begin gnulib module memmem-simple
|
## begin gnulib module memmem-simple
|
||||||
ifeq (,$(OMIT_GNULIB_MODULE_memmem-simple))
|
ifeq (,$(OMIT_GNULIB_MODULE_memmem-simple))
|
||||||
|
|
||||||
@@ -3729,6 +3739,14 @@ endif
|
|||||||
endif
|
endif
|
||||||
## end gnulib module stpcpy
|
## end gnulib module stpcpy
|
||||||
|
|
||||||
|
## begin gnulib module streq
|
||||||
|
ifeq (,$(OMIT_GNULIB_MODULE_streq))
|
||||||
|
|
||||||
|
libgnu_a_SOURCES += streq.c
|
||||||
|
|
||||||
|
endif
|
||||||
|
## end gnulib module streq
|
||||||
|
|
||||||
## begin gnulib module string-h
|
## begin gnulib module string-h
|
||||||
ifeq (,$(OMIT_GNULIB_MODULE_string-h))
|
ifeq (,$(OMIT_GNULIB_MODULE_string-h))
|
||||||
|
|
||||||
@@ -3763,6 +3781,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
|
|||||||
-e 's/@''GNULIB_MBS_ENDSWITH''@/$(GL_GNULIB_MBS_ENDSWITH)/g' \
|
-e 's/@''GNULIB_MBS_ENDSWITH''@/$(GL_GNULIB_MBS_ENDSWITH)/g' \
|
||||||
-e 's/@''GNULIB_MBS_STARTSWITH''@/$(GL_GNULIB_MBS_STARTSWITH)/g' \
|
-e 's/@''GNULIB_MBS_STARTSWITH''@/$(GL_GNULIB_MBS_STARTSWITH)/g' \
|
||||||
-e 's/@''GNULIB_MEMCHR''@/$(GL_GNULIB_MEMCHR)/g' \
|
-e 's/@''GNULIB_MEMCHR''@/$(GL_GNULIB_MEMCHR)/g' \
|
||||||
|
-e 's/@''GNULIB_MEMEQ''@/$(GL_GNULIB_MEMEQ)/g' \
|
||||||
-e 's/@''GNULIB_MEMMEM''@/$(GL_GNULIB_MEMMEM)/g' \
|
-e 's/@''GNULIB_MEMMEM''@/$(GL_GNULIB_MEMMEM)/g' \
|
||||||
-e 's/@''GNULIB_MEMPCPY''@/$(GL_GNULIB_MEMPCPY)/g' \
|
-e 's/@''GNULIB_MEMPCPY''@/$(GL_GNULIB_MEMPCPY)/g' \
|
||||||
-e 's/@''GNULIB_MEMRCHR''@/$(GL_GNULIB_MEMRCHR)/g' \
|
-e 's/@''GNULIB_MEMRCHR''@/$(GL_GNULIB_MEMRCHR)/g' \
|
||||||
@@ -3772,7 +3791,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
|
|||||||
-e 's/@''GNULIB_STPNCPY''@/$(GL_GNULIB_STPNCPY)/g' \
|
-e 's/@''GNULIB_STPNCPY''@/$(GL_GNULIB_STPNCPY)/g' \
|
||||||
-e 's/@''GNULIB_STRCHRNUL''@/$(GL_GNULIB_STRCHRNUL)/g' \
|
-e 's/@''GNULIB_STRCHRNUL''@/$(GL_GNULIB_STRCHRNUL)/g' \
|
||||||
-e 's/@''GNULIB_STRDUP''@/$(GL_GNULIB_STRDUP)/g' \
|
-e 's/@''GNULIB_STRDUP''@/$(GL_GNULIB_STRDUP)/g' \
|
||||||
-e 's/@''GNULIB_STRINGEQ''@/$(GL_GNULIB_STRINGEQ)/g' \
|
-e 's/@''GNULIB_STREQ''@/$(GL_GNULIB_STREQ)/g' \
|
||||||
-e 's/@''GNULIB_STRNCAT''@/$(GL_GNULIB_STRNCAT)/g' \
|
-e 's/@''GNULIB_STRNCAT''@/$(GL_GNULIB_STRNCAT)/g' \
|
||||||
-e 's/@''GNULIB_STRNCPY''@/$(GL_GNULIB_STRNCPY)/g' \
|
-e 's/@''GNULIB_STRNCPY''@/$(GL_GNULIB_STRNCPY)/g' \
|
||||||
-e 's/@''GNULIB_STRNDUP''@/$(GL_GNULIB_STRNDUP)/g' \
|
-e 's/@''GNULIB_STRNDUP''@/$(GL_GNULIB_STRNDUP)/g' \
|
||||||
@@ -3863,14 +3882,6 @@ EXTRA_DIST += string.in.h
|
|||||||
endif
|
endif
|
||||||
## end gnulib module string-h
|
## end gnulib module string-h
|
||||||
|
|
||||||
## begin gnulib module stringeq
|
|
||||||
ifeq (,$(OMIT_GNULIB_MODULE_stringeq))
|
|
||||||
|
|
||||||
libgnu_a_SOURCES += string.c
|
|
||||||
|
|
||||||
endif
|
|
||||||
## end gnulib module stringeq
|
|
||||||
|
|
||||||
## begin gnulib module strnlen
|
## begin gnulib module strnlen
|
||||||
ifeq (,$(OMIT_GNULIB_MODULE_strnlen))
|
ifeq (,$(OMIT_GNULIB_MODULE_strnlen))
|
||||||
|
|
||||||
@@ -3881,6 +3892,14 @@ endif
|
|||||||
endif
|
endif
|
||||||
## end gnulib module strnlen
|
## end gnulib module strnlen
|
||||||
|
|
||||||
|
## begin gnulib module strnul
|
||||||
|
ifeq (,$(OMIT_GNULIB_MODULE_strnul))
|
||||||
|
|
||||||
|
libgnu_a_SOURCES += strnul.c
|
||||||
|
|
||||||
|
endif
|
||||||
|
## end gnulib module strnul
|
||||||
|
|
||||||
## begin gnulib module strtoimax
|
## begin gnulib module strtoimax
|
||||||
ifeq (,$(OMIT_GNULIB_MODULE_strtoimax))
|
ifeq (,$(OMIT_GNULIB_MODULE_strtoimax))
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* streq, memeq, gl_strnul functions.
|
/* memeq function.
|
||||||
Copyright (C) 2025-2026 Free Software Foundation, Inc.
|
Copyright (C) 2025-2026 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is free software: you can redistribute it and/or modify
|
This file is free software: you can redistribute it and/or modify
|
||||||
@@ -14,6 +14,6 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#define _GL_STRING_INLINE _GL_EXTERN_INLINE
|
#define _GL_MEMEQ_INLINE _GL_EXTERN_INLINE
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -378,7 +378,7 @@ sha3_read_ctx (struct sha3_ctx const *restrict ctx, void *restrict resbuf)
|
|||||||
{
|
{
|
||||||
if (EVP_MD_CTX_copy_ex (evp_ctx, ctx->evp_ctx))
|
if (EVP_MD_CTX_copy_ex (evp_ctx, ctx->evp_ctx))
|
||||||
{
|
{
|
||||||
if (EVP_DigestFinal_ex (evp_ctx, resbuf, 0))
|
if (EVP_DigestFinal_ex (evp_ctx, resbuf, NULL))
|
||||||
result = resbuf;
|
result = resbuf;
|
||||||
err = EINVAL;
|
err = EINVAL;
|
||||||
}
|
}
|
||||||
|
|||||||
19
lib/streq.c
Normal file
19
lib/streq.c
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/* streq function.
|
||||||
|
Copyright (C) 2025-2026 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2.1 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This file is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#define _GL_STREQ_INLINE _GL_EXTERN_INLINE
|
||||||
|
#include <config.h>
|
||||||
|
#include <string.h>
|
||||||
@@ -888,6 +888,7 @@ static CHAR_T const c_month_names[][sizeof "September"] =
|
|||||||
L_("June"), L_("July"), L_("August"), L_("September"), L_("October"),
|
L_("June"), L_("July"), L_("August"), L_("September"), L_("October"),
|
||||||
L_("November"), L_("December")
|
L_("November"), L_("December")
|
||||||
};
|
};
|
||||||
|
static CHAR_T const c_ampm_letters[] = { L_('A'), L_('M'), L_('P'), L_('M') };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -1274,7 +1275,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
|
|||||||
# define f_month \
|
# define f_month \
|
||||||
(tp->tm_mon < 0 || tp->tm_mon > 11 ? L_("?") : c_month_names[tp->tm_mon])
|
(tp->tm_mon < 0 || tp->tm_mon > 11 ? L_("?") : c_month_names[tp->tm_mon])
|
||||||
/* The English AM/PM strings happen to have the same length, namely 2. */
|
/* The English AM/PM strings happen to have the same length, namely 2. */
|
||||||
# define ampm (L_("AMPM") + 2 * (tp->tm_hour > 11))
|
# define ampm (c_ampm_letters + 2 * (12 <= tp->tm_hour))
|
||||||
# define ap_len 2
|
# define ap_len 2
|
||||||
#endif
|
#endif
|
||||||
retval_t i = 0;
|
retval_t i = 0;
|
||||||
@@ -1358,7 +1359,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
|
|||||||
mbstate_t mbstate = mbstate_zero;
|
mbstate_t mbstate = mbstate_zero;
|
||||||
|
|
||||||
if (! format_end)
|
if (! format_end)
|
||||||
format_end = f + strlen (f) + 1;
|
format_end = strnul (f) + 1;
|
||||||
size_t fsize = format_end - f;
|
size_t fsize = format_end - f;
|
||||||
|
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
|
|||||||
@@ -81,9 +81,14 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
_GL_INLINE_HEADER_BEGIN
|
_GL_INLINE_HEADER_BEGIN
|
||||||
|
#ifndef _GL_MEMEQ_INLINE
|
||||||
#ifndef _GL_STRING_INLINE
|
# define _GL_MEMEQ_INLINE _GL_INLINE
|
||||||
# define _GL_STRING_INLINE _GL_INLINE
|
#endif
|
||||||
|
#ifndef _GL_STREQ_INLINE
|
||||||
|
# define _GL_STREQ_INLINE _GL_INLINE
|
||||||
|
#endif
|
||||||
|
#ifndef _GL_STRNUL_INLINE
|
||||||
|
# define _GL_STRNUL_INLINE _GL_INLINE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
|
/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
|
||||||
@@ -414,11 +419,11 @@ _GL_WARN_ON_USE_CXX (memchr,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Are S1 and S2, of size N, bytewise equal? */
|
/* Are S1 and S2, of size N, bytewise equal? */
|
||||||
#if @GNULIB_STRINGEQ@ && !@HAVE_DECL_MEMEQ@
|
#if @GNULIB_MEMEQ@ && !@HAVE_DECL_MEMEQ@
|
||||||
# ifdef __cplusplus
|
# ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
# endif
|
# endif
|
||||||
_GL_STRING_INLINE bool
|
_GL_MEMEQ_INLINE bool
|
||||||
memeq (void const *__s1, void const *__s2, size_t __n)
|
memeq (void const *__s1, void const *__s2, size_t __n)
|
||||||
{
|
{
|
||||||
return !memcmp (__s1, __s2, __n);
|
return !memcmp (__s1, __s2, __n);
|
||||||
@@ -799,11 +804,11 @@ _GL_CXXALIASWARN (strdup);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Are strings S1 and S2 equal? */
|
/* Are strings S1 and S2 equal? */
|
||||||
#if @GNULIB_STRINGEQ@ && !@HAVE_DECL_STREQ@
|
#if @GNULIB_STREQ@ && !@HAVE_DECL_STREQ@
|
||||||
# ifdef __cplusplus
|
# ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
# endif
|
# endif
|
||||||
_GL_STRING_INLINE bool
|
_GL_STREQ_INLINE bool
|
||||||
streq (char const *__s1, char const *__s2)
|
streq (char const *__s1, char const *__s2)
|
||||||
{
|
{
|
||||||
return !strcmp (__s1, __s2);
|
return !strcmp (__s1, __s2);
|
||||||
@@ -1243,10 +1248,10 @@ _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
|
|||||||
# ifdef __cplusplus
|
# ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
# endif
|
# endif
|
||||||
_GL_STRING_INLINE const char *gl_strnul (const char *string)
|
_GL_STRNUL_INLINE const char *gl_strnul (const char *string)
|
||||||
_GL_ATTRIBUTE_PURE
|
_GL_ATTRIBUTE_PURE
|
||||||
_GL_ARG_NONNULL ((1));
|
_GL_ARG_NONNULL ((1));
|
||||||
_GL_STRING_INLINE const char *gl_strnul (const char *string)
|
_GL_STRNUL_INLINE const char *gl_strnul (const char *string)
|
||||||
{
|
{
|
||||||
/* In gcc >= 7 or clang >= 4, we could use the expression
|
/* In gcc >= 7 or clang >= 4, we could use the expression
|
||||||
strchr (string, '\0')
|
strchr (string, '\0')
|
||||||
@@ -1260,21 +1265,29 @@ _GL_STRING_INLINE const char *gl_strnul (const char *string)
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
# ifdef __cplusplus
|
# ifdef __cplusplus
|
||||||
|
_GL_BEGIN_NAMESPACE
|
||||||
template <typename T> T strnul (T);
|
template <typename T> T strnul (T);
|
||||||
template <> inline const char *strnul<const char *> (const char *s)
|
template <> inline const char *strnul<const char *> (const char *s)
|
||||||
{ return gl_strnul (s); }
|
{ return gl_strnul (s); }
|
||||||
template <> inline char *strnul< char *> ( char *s)
|
template <> inline char *strnul< char *> ( char *s)
|
||||||
{ return const_cast<char *>(gl_strnul (s)); }
|
{ return const_cast<char *>(gl_strnul (s)); }
|
||||||
|
_GL_END_NAMESPACE
|
||||||
# else
|
# else
|
||||||
# if (defined __GNUC__ && __GNUC__ + (__GNUC_MINOR__ >= 9) > 4 && !defined __cplusplus) \
|
# if (defined __GNUC__ && __GNUC__ + (__GNUC_MINOR__ >= 9) > 4 && !defined __cplusplus) \
|
||||||
|| (defined __clang__ && __clang_major__ >= 3) \
|
|| (defined __clang__ && __clang_major__ >= 3) \
|
||||||
|| (defined __SUNPRO_C && __SUNPRO_C >= 0x5150) \
|
|| (defined __SUNPRO_C && __SUNPRO_C >= 0x5150) \
|
||||||
|| (__STDC_VERSION__ >= 201112L && !defined __GNUC__)
|
|| (__STDC_VERSION__ >= 201112L && !defined __GNUC__)
|
||||||
/* The compiler supports _Generic from ISO C11. */
|
/* The compiler supports _Generic from ISO C11. */
|
||||||
|
/* Since in C (but not in C++!), any function that accepts a '[const] char *'
|
||||||
|
also accepts a '[const] void *' as argument, we make sure that the function-
|
||||||
|
like macro does the same, by mapping its type first:
|
||||||
|
char *, void * -> void *
|
||||||
|
const char *, const void * -> const void *
|
||||||
|
This mapping is done through the conditional expression. */
|
||||||
# define strnul(s) \
|
# define strnul(s) \
|
||||||
_Generic (s, \
|
_Generic (1 ? (s) : (void *) 99, \
|
||||||
char * : (char *) gl_strnul (s), \
|
void * : (char *) gl_strnul (s), \
|
||||||
const char * : gl_strnul (s))
|
const void * : gl_strnul (s))
|
||||||
# else
|
# else
|
||||||
# define strnul(s) \
|
# define strnul(s) \
|
||||||
((char *) gl_strnul (s))
|
((char *) gl_strnul (s))
|
||||||
@@ -1609,8 +1622,6 @@ _GL_EXTERN_C char * mbstok_r (char *restrict string, const char *delim,
|
|||||||
_GL_EXTERN_C bool mbs_startswith (const char *string, const char *prefix)
|
_GL_EXTERN_C bool mbs_startswith (const char *string, const char *prefix)
|
||||||
_GL_ATTRIBUTE_PURE
|
_GL_ATTRIBUTE_PURE
|
||||||
_GL_ARG_NONNULL ((1, 2));
|
_GL_ARG_NONNULL ((1, 2));
|
||||||
/* No extra code is needed for multibyte locales for this function. */
|
|
||||||
# define mbs_startswith str_startswith
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if @GNULIB_MBS_ENDSWITH@
|
#if @GNULIB_MBS_ENDSWITH@
|
||||||
|
|||||||
19
lib/strnul.c
Normal file
19
lib/strnul.c
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/* gl_strnul function.
|
||||||
|
Copyright (C) 2025-2026 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2.1 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This file is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#define _GL_STRNUL_INLINE _GL_EXTERN_INLINE
|
||||||
|
#include <config.h>
|
||||||
|
#include <string.h>
|
||||||
@@ -146,7 +146,7 @@ save_abbr (timezone_t tz, struct tm *tm)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
zone_copy += strlen (zone_copy) + 1;
|
zone_copy = strnul (zone_copy) + 1;
|
||||||
if (!*zone_copy && tz->next)
|
if (!*zone_copy && tz->next)
|
||||||
{
|
{
|
||||||
tz = tz->next;
|
tz = tz->next;
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ AC_DEFUN([gl_EARLY],
|
|||||||
# Code from module malloc-gnu:
|
# Code from module malloc-gnu:
|
||||||
# Code from module malloc-posix:
|
# Code from module malloc-posix:
|
||||||
# Code from module manywarnings:
|
# Code from module manywarnings:
|
||||||
|
# Code from module memeq:
|
||||||
# Code from module memmem-simple:
|
# Code from module memmem-simple:
|
||||||
# Code from module mempcpy:
|
# Code from module mempcpy:
|
||||||
# Code from module memrchr:
|
# Code from module memrchr:
|
||||||
@@ -196,9 +197,10 @@ AC_DEFUN([gl_EARLY],
|
|||||||
# Code from module stdio-windows:
|
# Code from module stdio-windows:
|
||||||
# Code from module stdlib-h:
|
# Code from module stdlib-h:
|
||||||
# Code from module stpcpy:
|
# Code from module stpcpy:
|
||||||
|
# Code from module streq:
|
||||||
# Code from module string-h:
|
# Code from module string-h:
|
||||||
# Code from module stringeq:
|
|
||||||
# Code from module strnlen:
|
# Code from module strnlen:
|
||||||
|
# Code from module strnul:
|
||||||
# Code from module strtoimax:
|
# Code from module strtoimax:
|
||||||
# Code from module strtoll:
|
# Code from module strtoll:
|
||||||
# Code from module symlink:
|
# Code from module symlink:
|
||||||
@@ -446,6 +448,8 @@ AC_DEFUN([gl_INIT],
|
|||||||
AC_LIBOBJ([malloc])
|
AC_LIBOBJ([malloc])
|
||||||
fi
|
fi
|
||||||
gl_STDLIB_MODULE_INDICATOR([malloc-posix])
|
gl_STDLIB_MODULE_INDICATOR([malloc-posix])
|
||||||
|
gl_FUNC_MEMEQ
|
||||||
|
gl_STRING_MODULE_INDICATOR([memeq])
|
||||||
gl_FUNC_MEMMEM_SIMPLE
|
gl_FUNC_MEMMEM_SIMPLE
|
||||||
if test $HAVE_MEMMEM = 0 || test $REPLACE_MEMMEM = 1; then
|
if test $HAVE_MEMMEM = 0 || test $REPLACE_MEMMEM = 1; then
|
||||||
AC_LIBOBJ([memmem])
|
AC_LIBOBJ([memmem])
|
||||||
@@ -621,12 +625,11 @@ AC_DEFUN([gl_INIT],
|
|||||||
gl_PREREQ_STPCPY
|
gl_PREREQ_STPCPY
|
||||||
])
|
])
|
||||||
gl_STRING_MODULE_INDICATOR([stpcpy])
|
gl_STRING_MODULE_INDICATOR([stpcpy])
|
||||||
|
gl_FUNC_STREQ
|
||||||
|
gl_STRING_MODULE_INDICATOR([streq])
|
||||||
gl_STRING_H
|
gl_STRING_H
|
||||||
gl_STRING_H_REQUIRE_DEFAULTS
|
gl_STRING_H_REQUIRE_DEFAULTS
|
||||||
AC_PROG_MKDIR_P
|
AC_PROG_MKDIR_P
|
||||||
gl_FUNC_STREQ
|
|
||||||
gl_FUNC_MEMEQ
|
|
||||||
gl_STRING_MODULE_INDICATOR([stringeq])
|
|
||||||
gl_FUNC_STRNLEN
|
gl_FUNC_STRNLEN
|
||||||
gl_CONDITIONAL([GL_COND_OBJ_STRNLEN],
|
gl_CONDITIONAL([GL_COND_OBJ_STRNLEN],
|
||||||
[test $HAVE_DECL_STRNLEN = 0 || test $REPLACE_STRNLEN = 1])
|
[test $HAVE_DECL_STRNLEN = 0 || test $REPLACE_STRNLEN = 1])
|
||||||
@@ -634,6 +637,7 @@ AC_DEFUN([gl_INIT],
|
|||||||
gl_PREREQ_STRNLEN
|
gl_PREREQ_STRNLEN
|
||||||
])
|
])
|
||||||
gl_STRING_MODULE_INDICATOR([strnlen])
|
gl_STRING_MODULE_INDICATOR([strnlen])
|
||||||
|
gl_STRING_MODULE_INDICATOR([strnul])
|
||||||
gl_FUNC_STRTOIMAX
|
gl_FUNC_STRTOIMAX
|
||||||
gl_CONDITIONAL([GL_COND_OBJ_STRTOIMAX],
|
gl_CONDITIONAL([GL_COND_OBJ_STRTOIMAX],
|
||||||
[test $HAVE_DECL_STRTOIMAX = 0 || test $REPLACE_STRTOIMAX = 1])
|
[test $HAVE_DECL_STRTOIMAX = 0 || test $REPLACE_STRTOIMAX = 1])
|
||||||
@@ -1405,6 +1409,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||||||
lib/md5-stream.c
|
lib/md5-stream.c
|
||||||
lib/md5.c
|
lib/md5.c
|
||||||
lib/md5.h
|
lib/md5.h
|
||||||
|
lib/memeq.c
|
||||||
lib/memmem.c
|
lib/memmem.c
|
||||||
lib/mempcpy.c
|
lib/mempcpy.c
|
||||||
lib/memrchr.c
|
lib/memrchr.c
|
||||||
@@ -1476,11 +1481,12 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||||||
lib/stdlib.in.h
|
lib/stdlib.in.h
|
||||||
lib/stpcpy.c
|
lib/stpcpy.c
|
||||||
lib/str-two-way.h
|
lib/str-two-way.h
|
||||||
|
lib/streq.c
|
||||||
lib/strftime.c
|
lib/strftime.c
|
||||||
lib/strftime.h
|
lib/strftime.h
|
||||||
lib/string.c
|
|
||||||
lib/string.in.h
|
lib/string.in.h
|
||||||
lib/strnlen.c
|
lib/strnlen.c
|
||||||
|
lib/strnul.c
|
||||||
lib/strtoimax.c
|
lib/strtoimax.c
|
||||||
lib/strtol.c
|
lib/strtol.c
|
||||||
lib/strtoll.c
|
lib/strtoll.c
|
||||||
@@ -1581,6 +1587,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||||||
m4/manywarnings.m4
|
m4/manywarnings.m4
|
||||||
m4/mbstate_t.m4
|
m4/mbstate_t.m4
|
||||||
m4/md5.m4
|
m4/md5.m4
|
||||||
|
m4/memeq.m4
|
||||||
m4/memmem.m4
|
m4/memmem.m4
|
||||||
m4/mempcpy.m4
|
m4/mempcpy.m4
|
||||||
m4/memrchr.m4
|
m4/memrchr.m4
|
||||||
@@ -1631,8 +1638,8 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||||||
m4/stdio_h.m4
|
m4/stdio_h.m4
|
||||||
m4/stdlib_h.m4
|
m4/stdlib_h.m4
|
||||||
m4/stpcpy.m4
|
m4/stpcpy.m4
|
||||||
|
m4/streq.m4
|
||||||
m4/string_h.m4
|
m4/string_h.m4
|
||||||
m4/stringeq.m4
|
|
||||||
m4/strnlen.m4
|
m4/strnlen.m4
|
||||||
m4/strtoimax.m4
|
m4/strtoimax.m4
|
||||||
m4/strtoll.m4
|
m4/strtoll.m4
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# stringeq.m4
|
# memeq.m4
|
||||||
# serial 1
|
# serial 1
|
||||||
dnl Copyright (C) 2025-2026 Free Software Foundation, Inc.
|
dnl Copyright (C) 2025-2026 Free Software Foundation, Inc.
|
||||||
dnl This file is free software; the Free Software Foundation
|
dnl This file is free software; the Free Software Foundation
|
||||||
@@ -6,15 +6,6 @@ dnl gives unlimited permission to copy and/or distribute it,
|
|||||||
dnl with or without modifications, as long as this notice is preserved.
|
dnl with or without modifications, as long as this notice is preserved.
|
||||||
dnl This file is offered as-is, without any warranty.
|
dnl This file is offered as-is, without any warranty.
|
||||||
|
|
||||||
AC_DEFUN([gl_FUNC_STREQ],
|
|
||||||
[
|
|
||||||
AC_REQUIRE([gl_STRING_H_DEFAULTS])
|
|
||||||
AC_CHECK_DECLS_ONCE([streq])
|
|
||||||
if test $ac_cv_have_decl_streq != no; then
|
|
||||||
HAVE_DECL_STREQ=1
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFUN([gl_FUNC_MEMEQ],
|
AC_DEFUN([gl_FUNC_MEMEQ],
|
||||||
[
|
[
|
||||||
AC_REQUIRE([gl_STRING_H_DEFAULTS])
|
AC_REQUIRE([gl_STRING_H_DEFAULTS])
|
||||||
16
m4/streq.m4
Normal file
16
m4/streq.m4
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# streq.m4
|
||||||
|
# serial 1
|
||||||
|
dnl Copyright (C) 2025-2026 Free Software Foundation, Inc.
|
||||||
|
dnl This file is free software; the Free Software Foundation
|
||||||
|
dnl gives unlimited permission to copy and/or distribute it,
|
||||||
|
dnl with or without modifications, as long as this notice is preserved.
|
||||||
|
dnl This file is offered as-is, without any warranty.
|
||||||
|
|
||||||
|
AC_DEFUN([gl_FUNC_STREQ],
|
||||||
|
[
|
||||||
|
AC_REQUIRE([gl_STRING_H_DEFAULTS])
|
||||||
|
AC_CHECK_DECLS_ONCE([streq])
|
||||||
|
if test $ac_cv_have_decl_streq != no; then
|
||||||
|
HAVE_DECL_STREQ=1
|
||||||
|
fi
|
||||||
|
])
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# string_h.m4
|
# string_h.m4
|
||||||
# serial 47
|
# serial 48
|
||||||
dnl Copyright (C) 2007-2026 Free Software Foundation, Inc.
|
dnl Copyright (C) 2007-2026 Free Software Foundation, Inc.
|
||||||
dnl This file is free software; the Free Software Foundation
|
dnl This file is free software; the Free Software Foundation
|
||||||
dnl gives unlimited permission to copy and/or distribute it,
|
dnl gives unlimited permission to copy and/or distribute it,
|
||||||
@@ -54,6 +54,7 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS],
|
|||||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFSL])
|
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFSL])
|
||||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFSLL])
|
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFSLL])
|
||||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMCHR])
|
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMCHR])
|
||||||
|
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMEQ])
|
||||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMMEM])
|
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMMEM])
|
||||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMPCPY])
|
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMPCPY])
|
||||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMRCHR])
|
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMRCHR])
|
||||||
@@ -63,7 +64,7 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS],
|
|||||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPNCPY])
|
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPNCPY])
|
||||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCHRNUL])
|
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCHRNUL])
|
||||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRDUP])
|
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRDUP])
|
||||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRINGEQ])
|
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STREQ])
|
||||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCAT])
|
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCAT])
|
||||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCPY])
|
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCPY])
|
||||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNDUP])
|
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNDUP])
|
||||||
|
|||||||
Reference in New Issue
Block a user