18 #ifndef _@GUARD_PREFIX@_STRING_H
21 @PRAGMA_SYSTEM_HEADER@
26 #@INCLUDE_NEXT@ @NEXT_STRING_H@
28 #ifndef _@GUARD_PREFIX@_STRING_H
29 #define _@GUARD_PREFIX@_STRING_H
35 #if @GNULIB_MBSLEN@ && defined __MirBSD__
41 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
42 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
44 # define _GL_ATTRIBUTE_PURE
49 #if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \
50 && ! defined __GLIBC__
68 #elif defined GNULIB_POSIXCHECK
70 # if HAVE_RAW_DECL_FFSL
83 #elif defined GNULIB_POSIXCHECK
85 # if HAVE_RAW_DECL_FFSLL
86 _GL_WARN_ON_USE (ffsll,
"ffsll is not portable - use the ffsll module");
94 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
95 # define memchr rpl_memchr
111 void *, (
void const *__s,
int __c,
size_t __n),
112 void const *, (
void const *__s,
int __c,
size_t __n));
114 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
115 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
118 (
void const *__s,
int __c,
size_t __n));
122 #elif defined GNULIB_POSIXCHECK
126 "use gnulib module memchr for portability" );
131 # if @REPLACE_MEMMEM@
132 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
133 # define memmem rpl_memmem
136 (
void const *__haystack,
size_t __haystack_len,
137 void const *__needle,
size_t __needle_len)
141 (
void const *__haystack,
size_t __haystack_len,
142 void const *__needle,
size_t __needle_len));
144 # if ! @HAVE_DECL_MEMMEM@
146 (
void const *__haystack,
size_t __haystack_len,
147 void const *__needle,
size_t __needle_len)
152 (
void const *__haystack,
size_t __haystack_len,
153 void const *__needle,
size_t __needle_len));
156 #elif defined GNULIB_POSIXCHECK
158 # if HAVE_RAW_DECL_MEMMEM
160 "use gnulib module memmem-simple for portability, "
161 "and module memmem for speed" );
168 # if ! @HAVE_MEMPCPY@
170 (
void *restrict __dest,
void const *restrict __src,
175 (
void *restrict __dest,
void const *restrict __src,
178 #elif defined GNULIB_POSIXCHECK
180 # if HAVE_RAW_DECL_MEMPCPY
182 "use gnulib module mempcpy for portability");
188 # if ! @HAVE_DECL_MEMRCHR@
197 void *, (
void const *,
int,
size_t),
198 void const *, (
void const *,
int,
size_t));
199 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
200 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
206 #elif defined GNULIB_POSIXCHECK
208 # if HAVE_RAW_DECL_MEMRCHR
210 "use gnulib module memrchr for portability");
217 #if @GNULIB_RAWMEMCHR@
218 # if ! @HAVE_RAWMEMCHR@
227 void *, (
void const *__s,
int __c_in),
228 void const *, (
void const *__s,
int __c_in));
229 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
230 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
236 #elif defined GNULIB_POSIXCHECK
238 # if HAVE_RAW_DECL_RAWMEMCHR
240 "use gnulib module rawmemchr for portability");
248 (
char *restrict __dst,
char const *restrict __src)
252 (
char *restrict __dst,
char const *restrict __src));
254 #elif defined GNULIB_POSIXCHECK
256 # if HAVE_RAW_DECL_STPCPY
258 "use gnulib module stpcpy for portability");
265 # if @REPLACE_STPNCPY@
266 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
268 # define stpncpy rpl_stpncpy
271 (
char *restrict __dst,
char const *restrict __src,
275 (
char *restrict __dst,
char const *restrict __src,
278 # if ! @HAVE_STPNCPY@
280 (
char *restrict __dst,
char const *restrict __src,
285 (
char *restrict __dst,
char const *restrict __src,
289 #elif defined GNULIB_POSIXCHECK
291 # if HAVE_RAW_DECL_STPNCPY
293 "use gnulib module stpncpy for portability");
297 #if defined GNULIB_POSIXCHECK
302 _GL_WARN_ON_USE (strchr,
"strchr cannot work correctly on character strings "
303 "in some multibyte locales - "
304 "use mbschr if you care about internationalization");
308 #if @GNULIB_STRCHRNUL@
309 # if @REPLACE_STRCHRNUL@
310 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
311 # define strchrnul rpl_strchrnul
317 (
const char *str,
int ch));
319 # if ! @HAVE_STRCHRNUL@
328 char *, (
char const *__s,
int __c_in),
329 char const *, (
char const *__s,
int __c_in));
331 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
332 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
338 #elif defined GNULIB_POSIXCHECK
340 # if HAVE_RAW_DECL_STRCHRNUL
342 "use gnulib module strchrnul for portability");
348 # if @REPLACE_STRDUP@
349 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
351 # define strdup rpl_strdup
356 # if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
360 # if !(@HAVE_DECL_STRDUP@ || defined strdup)
366 #elif defined GNULIB_POSIXCHECK
368 # if HAVE_RAW_DECL_STRDUP
370 "use gnulib module strdup for portability");
376 # if @REPLACE_STRNCAT@
377 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
379 # define strncat rpl_strncat
388 #elif defined GNULIB_POSIXCHECK
390 # if HAVE_RAW_DECL_STRNCAT
392 "use gnulib module strncat for portability");
398 # if @REPLACE_STRNDUP@
399 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
401 # define strndup rpl_strndup
407 # if ! @HAVE_DECL_STRNDUP@
414 #elif defined GNULIB_POSIXCHECK
416 # if HAVE_RAW_DECL_STRNDUP
418 "use gnulib module strndup for portability");
426 # if @REPLACE_STRNLEN@
427 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
429 # define strnlen rpl_strnlen
436 # if ! @HAVE_DECL_STRNLEN@
444 #elif defined GNULIB_POSIXCHECK
446 # if HAVE_RAW_DECL_STRNLEN
448 "use gnulib module strnlen for portability");
452 #if defined GNULIB_POSIXCHECK
459 _GL_WARN_ON_USE (strcspn,
"strcspn cannot work correctly on character strings "
460 "in multibyte locales - "
461 "use mbscspn if you care about internationalization");
466 # if ! @HAVE_STRPBRK@
475 char *, (
char const *__s,
char const *__accept),
476 const char *, (
char const *__s,
char const *__accept));
477 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
478 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
481 (
char const *__s,
char const *__accept));
485 # if defined GNULIB_POSIXCHECK
491 _GL_WARN_ON_USE (strpbrk,
"strpbrk cannot work correctly on character strings "
492 "in multibyte locales - "
493 "use mbspbrk if you care about internationalization");
495 #elif defined GNULIB_POSIXCHECK
497 # if HAVE_RAW_DECL_STRPBRK
499 "use gnulib module strpbrk for portability");
503 #if defined GNULIB_POSIXCHECK
508 _GL_WARN_ON_USE (strspn,
"strspn cannot work correctly on character strings "
509 "in multibyte locales - "
510 "use mbsspn if you care about internationalization");
513 #if defined GNULIB_POSIXCHECK
518 _GL_WARN_ON_USE (strrchr,
"strrchr cannot work correctly on character strings "
519 "in some multibyte locales - "
520 "use mbsrchr if you care about internationalization");
542 (
char **restrict __stringp,
char const *restrict __delim)
546 (
char **restrict __stringp,
char const *restrict __delim));
548 # if defined GNULIB_POSIXCHECK
550 _GL_WARN_ON_USE (strsep,
"strsep cannot work correctly on character strings "
551 "in multibyte locales - "
552 "use mbssep if you care about internationalization");
554 #elif defined GNULIB_POSIXCHECK
556 # if HAVE_RAW_DECL_STRSEP
558 "use gnulib module strsep for portability");
563 # if @REPLACE_STRSTR@
564 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
565 # define strstr rpl_strstr
567 _GL_FUNCDECL_RPL (strstr,
char *, (
const char *haystack,
const char *needle)
570 _GL_CXXALIAS_RPL (strstr,
char *, (
const char *haystack,
const char *needle));
576 char *, (
const char *haystack,
const char *needle),
577 const char *, (
const char *haystack,
const char *needle));
579 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
580 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
583 (
const char *haystack,
const char *needle));
587 #elif defined GNULIB_POSIXCHECK
594 _GL_WARN_ON_USE (strstr,
"strstr is quadratic on many systems, and cannot "
595 "work correctly on character strings in most "
596 "multibyte locales - "
597 "use mbsstr if you care about internationalization, "
598 "or use strstr if you care about speed");
603 #if @GNULIB_STRCASESTR@
604 # if @REPLACE_STRCASESTR@
605 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
606 # define strcasestr rpl_strcasestr
609 (
const char *haystack,
const char *needle)
613 (
const char *haystack,
const char *needle));
615 # if ! @HAVE_STRCASESTR@
617 (
const char *haystack,
const char *needle)
625 char *, (
const char *haystack,
const char *needle),
626 const char *, (
const char *haystack,
const char *needle));
628 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
629 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
632 (
const char *haystack,
const char *needle));
636 #elif defined GNULIB_POSIXCHECK
641 # if HAVE_RAW_DECL_STRCASESTR
642 _GL_WARN_ON_USE (strcasestr,
"strcasestr does work correctly on character "
643 "strings in multibyte locales - "
644 "use mbscasestr if you care about "
645 "internationalization, or use c-strcasestr if you want "
646 "a locale independent function");
672 #if @GNULIB_STRTOK_R@
673 # if @REPLACE_STRTOK_R@
674 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
676 # define strtok_r rpl_strtok_r
679 (
char *restrict s,
char const *restrict delim,
680 char **restrict save_ptr)
683 (
char *restrict s,
char const *restrict delim,
684 char **restrict save_ptr));
686 # if @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK
689 # if ! @HAVE_DECL_STRTOK_R@
691 (
char *restrict s,
char const *restrict delim,
692 char **restrict save_ptr)
696 (
char *restrict s,
char const *restrict delim,
697 char **restrict save_ptr));
700 # if defined GNULIB_POSIXCHECK
701 _GL_WARN_ON_USE (strtok_r,
"strtok_r cannot work correctly on character "
702 "strings in multibyte locales - "
703 "use mbstok_r if you care about internationalization");
705 #elif defined GNULIB_POSIXCHECK
707 # if HAVE_RAW_DECL_STRTOK_R
709 "use gnulib module strtok_r for portability");
724 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
725 # define mbslen rpl_mbslen
743 _GL_EXTERN_C size_t mbsnlen (
const char *
string,
size_t len)
754 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
755 # define mbschr rpl_mbschr
775 # if defined __hpux || defined __INTERIX
776 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
777 # define mbsrchr rpl_mbsrchr
797 _GL_EXTERN_C char * mbsstr (
const char *haystack,
const char *needle)
802 #if @GNULIB_MBSCASECMP@
814 #if @GNULIB_MBSNCASECMP@
824 _GL_EXTERN_C int mbsncasecmp (
const char *
s1,
const char *s2,
size_t n)
829 #if @GNULIB_MBSPCASECMP@
843 #if @GNULIB_MBSCASESTR@
849 _GL_EXTERN_C char * mbscasestr (
const char *haystack,
const char *needle)
860 _GL_EXTERN_C size_t mbscspn (
const char *
string,
const char *accept)
871 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
872 # define mbspbrk rpl_mbspbrk
877 _GL_CXXALIAS_RPL (mbspbrk,
char *, (
const char *
string,
const char *accept));
882 _GL_CXXALIAS_SYS (mbspbrk,
char *, (
const char *
string,
const char *accept));
893 _GL_EXTERN_C size_t mbsspn (
const char *
string,
const char *reject)
913 _GL_EXTERN_C char * mbssep (
char **stringp,
const char *delim)
917 #if @GNULIB_MBSTOK_R@
934 _GL_EXTERN_C char * mbstok_r (
char *
string,
const char *delim,
char **save_ptr)
939 #if @GNULIB_STRERROR@
940 # if @REPLACE_STRERROR@
941 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
943 # define strerror rpl_strerror
951 #elif defined GNULIB_POSIXCHECK
955 "use gnulib module strerror to guarantee non-NULL result");
960 #if @GNULIB_STRERROR_R@
961 # if @REPLACE_STRERROR_R@
962 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
964 # define strerror_r rpl_strerror_r
970 # if !@HAVE_DECL_STRERROR_R@
976 # if @HAVE_DECL_STRERROR_R@
979 #elif defined GNULIB_POSIXCHECK
981 # if HAVE_RAW_DECL_STRERROR_R
983 "use gnulib module strerror_r-posix for portability");
987 #if @GNULIB_STRSIGNAL@
988 # if @REPLACE_STRSIGNAL@
989 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
990 # define strsignal rpl_strsignal
995 # if ! @HAVE_DECL_STRSIGNAL@
1003 #elif defined GNULIB_POSIXCHECK
1005 # if HAVE_RAW_DECL_STRSIGNAL
1007 "use gnulib module strsignal for portability");
1011 #if @GNULIB_STRVERSCMP@
1012 # if !@HAVE_STRVERSCMP@
1019 #elif defined GNULIB_POSIXCHECK
1021 # if HAVE_RAW_DECL_STRVERSCMP
1023 "use gnulib module strverscmp for portability");
#define src(name, suf)
HPFC by Fabien Coelho, May 1993 and later...
#define _GL_ARG_NONNULL(params)
A C macro for declaring that specific arguments must not be NULL.
#define _GL_EXTERN_C
C++ compatible function declaration macros.
#define _GL_CXXALIAS_RPL(func, rettype, parameters)
_GL_CXXALIAS_RPL (func, rettype, parameters); declares a C++ alias called GNULIB_NAMESPACE::func that...
#define _GL_FUNCDECL_RPL(func, rettype, parameters_and_attributes)
_GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); declares a replacement function,...
#define _GL_CXXALIAS_SYS_CAST2(func, rettype, parameters, rettype2, parameters2)
_GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); is like _GL_CXXALIAS_SYS (...
#define _GL_CXXALIAS_SYS_CAST(func, rettype, parameters)
_GL_CXXALIAS_SYS_CAST (func, rettype, parameters); is like _GL_CXXALIAS_SYS (func,...
#define _GL_CXXALIASWARN(func)
_GL_CXXALIASWARN (func); causes a warning to be emitted when ::func is used but not when GNULIB_NAMES...
#define _GL_CXXALIAS_SYS(func, rettype, parameters)
_GL_CXXALIAS_SYS (func, rettype, parameters); declares a C++ alias called GNULIB_NAMESPACE::func that...
#define _GL_CXXALIASWARN1(func, rettype, parameters_and_attributes)
_GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); causes a warning to be emitted when the...
#define _GL_FUNCDECL_SYS(func, rettype, parameters_and_attributes)
_GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); declares the system function,...
#define _GL_WARN_ON_USE(function, message)
A C macro for emitting warnings if a function is used.
#define _GL_ATTRIBUTE_PURE
NetBSD 5.0 mis-defines NULL.
void * rawmemchr(const void *s, int c_in)
Searching in a string.
static const char * prefix
char * strchrnul(const char *s, int c_in)
Searching in a string.
char * strndup(char const *s, size_t n)
A replacement function, for systems that lack strndup.
size_t strnlen(const char *string, size_t maxlen)
Find the length of STRING, but scan at most MAXLEN characters.