mirror of
https://git.savannah.gnu.org/git/gnulib.git
synced 2025-08-08 17:22:05 +03:00
mbs_startswith: New module.
* lib/string.in.h (mbs_startswith): New declaration. * m4/string_h.m4 (gl_STRING_H_REQUIRE_DEFAULTS): Initialize GNULIB_MBS_STARTSWITH. * modules/string-h (Makefile.am): Substitute GNULIB_MBS_STARTSWITH. * modules/mbs_startswith: New file.
This commit is contained in:
@@ -1,3 +1,12 @@
|
||||
2025-01-03 Bruno Haible <bruno@clisp.org>
|
||||
|
||||
mbs_startswith: New module.
|
||||
* lib/string.in.h (mbs_startswith): New declaration.
|
||||
* m4/string_h.m4 (gl_STRING_H_REQUIRE_DEFAULTS): Initialize
|
||||
GNULIB_MBS_STARTSWITH.
|
||||
* modules/string-h (Makefile.am): Substitute GNULIB_MBS_STARTSWITH.
|
||||
* modules/mbs_startswith: New file.
|
||||
|
||||
2025-01-03 Bruno Haible <bruno@clisp.org>
|
||||
|
||||
tests: Use str_endswith.
|
||||
|
@@ -1317,6 +1317,16 @@ _GL_EXTERN_C char * mbstok_r (char *restrict string, const char *delim,
|
||||
_GL_ARG_NONNULL ((2, 3));
|
||||
#endif
|
||||
|
||||
#if @GNULIB_MBS_STARTSWITH@
|
||||
/* Returns true if STRING starts with PREFIX.
|
||||
Returns false otherwise. */
|
||||
_GL_EXTERN_C int mbs_startswith (const char *string, const char *prefix)
|
||||
_GL_ATTRIBUTE_PURE
|
||||
_GL_ARG_NONNULL ((1, 2));
|
||||
/* No extra code is needed for multibyte locales for this function. */
|
||||
# define mbs_startswith str_startswith
|
||||
#endif
|
||||
|
||||
/* Map any int, typically from errno, into an error message. */
|
||||
#if @GNULIB_STRERROR@
|
||||
# if @REPLACE_STRERROR@
|
||||
|
@@ -1,5 +1,5 @@
|
||||
# string_h.m4
|
||||
# serial 41
|
||||
# serial 42
|
||||
dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
@@ -86,6 +86,7 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS],
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSPN])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSEP])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOK_R])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBS_STARTSWITH])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R])
|
||||
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP])
|
||||
|
22
modules/mbs_startswith
Normal file
22
modules/mbs_startswith
Normal file
@@ -0,0 +1,22 @@
|
||||
Description:
|
||||
mbs_startswith() function: test whether a multibyte string starts with a given prefix.
|
||||
|
||||
Files:
|
||||
|
||||
Depends-on:
|
||||
string-h
|
||||
str_startswith
|
||||
|
||||
configure.ac:
|
||||
gl_STRING_MODULE_INDICATOR([mbs_startswith])
|
||||
|
||||
Makefile.am:
|
||||
|
||||
Include:
|
||||
<string.h>
|
||||
|
||||
License:
|
||||
LGPLv2+
|
||||
|
||||
Maintainer:
|
||||
all
|
@@ -51,6 +51,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
|
||||
-e 's/@''GNULIB_MBSSPN''@/$(GNULIB_MBSSPN)/g' \
|
||||
-e 's/@''GNULIB_MBSSEP''@/$(GNULIB_MBSSEP)/g' \
|
||||
-e 's/@''GNULIB_MBSTOK_R''@/$(GNULIB_MBSTOK_R)/g' \
|
||||
-e 's/@''GNULIB_MBS_STARTSWITH''@/$(GNULIB_MBS_STARTSWITH)/g' \
|
||||
-e 's/@''GNULIB_MEMCHR''@/$(GNULIB_MEMCHR)/g' \
|
||||
-e 's/@''GNULIB_MEMMEM''@/$(GNULIB_MEMMEM)/g' \
|
||||
-e 's/@''GNULIB_MEMPCPY''@/$(GNULIB_MEMPCPY)/g' \
|
||||
|
Reference in New Issue
Block a user