19 #ifndef _@GUARD_PREFIX@_STRING_H
22 @PRAGMA_SYSTEM_HEADER@
27 #@INCLUDE_NEXT@ @NEXT_STRING_H@
29 #ifndef _@GUARD_PREFIX@_STRING_H
30 #define _@GUARD_PREFIX@_STRING_H
36 #if @GNULIB_MBSLEN@ && defined __MirBSD__
42 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
43 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
45 # define _GL_ATTRIBUTE_PURE
50 #if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \
51 && ! defined __GLIBC__
69 #elif defined GNULIB_POSIXCHECK
71 # if HAVE_RAW_DECL_FFSL
84 #elif defined GNULIB_POSIXCHECK
86 # if HAVE_RAW_DECL_FFSLL
87 _GL_WARN_ON_USE (ffsll,
"ffsll is not portable - use the ffsll module");
95 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
96 # define memchr rpl_memchr
112 void *, (
void const *__s,
int __c,
size_t __n),
113 void const *, (
void const *__s,
int __c,
size_t __n));
115 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
116 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
119 (
void const *__s,
int __c,
size_t __n));
123 #elif defined GNULIB_POSIXCHECK
127 "use gnulib module memchr for portability" );
132 # if @REPLACE_MEMMEM@
133 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
134 # define memmem rpl_memmem
137 (
void const *__haystack,
size_t __haystack_len,
138 void const *__needle,
size_t __needle_len)
142 (
void const *__haystack,
size_t __haystack_len,
143 void const *__needle,
size_t __needle_len));
145 # if ! @HAVE_DECL_MEMMEM@
147 (
void const *__haystack,
size_t __haystack_len,
148 void const *__needle,
size_t __needle_len)
153 (
void const *__haystack,
size_t __haystack_len,
154 void const *__needle,
size_t __needle_len));
157 #elif defined GNULIB_POSIXCHECK
159 # if HAVE_RAW_DECL_MEMMEM
161 "use gnulib module memmem-simple for portability, "
162 "and module memmem for speed" );
169 # if ! @HAVE_MEMPCPY@
171 (
void *restrict __dest,
void const *restrict __src,
176 (
void *restrict __dest,
void const *restrict __src,
179 #elif defined GNULIB_POSIXCHECK
181 # if HAVE_RAW_DECL_MEMPCPY
183 "use gnulib module mempcpy for portability");
189 # if ! @HAVE_DECL_MEMRCHR@
198 void *, (
void const *,
int,
size_t),
199 void const *, (
void const *,
int,
size_t));
200 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
201 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
207 #elif defined GNULIB_POSIXCHECK
209 # if HAVE_RAW_DECL_MEMRCHR
211 "use gnulib module memrchr for portability");
218 #if @GNULIB_RAWMEMCHR@
219 # if ! @HAVE_RAWMEMCHR@
228 void *, (
void const *__s,
int __c_in),
229 void const *, (
void const *__s,
int __c_in));
230 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
231 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
237 #elif defined GNULIB_POSIXCHECK
239 # if HAVE_RAW_DECL_RAWMEMCHR
241 "use gnulib module rawmemchr for portability");
249 (
char *restrict __dst,
char const *restrict __src)
253 (
char *restrict __dst,
char const *restrict __src));
255 #elif defined GNULIB_POSIXCHECK
257 # if HAVE_RAW_DECL_STPCPY
259 "use gnulib module stpcpy for portability");
266 # if @REPLACE_STPNCPY@
267 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
269 # define stpncpy rpl_stpncpy
272 (
char *restrict __dst,
char const *restrict __src,
276 (
char *restrict __dst,
char const *restrict __src,
279 # if ! @HAVE_STPNCPY@
281 (
char *restrict __dst,
char const *restrict __src,
286 (
char *restrict __dst,
char const *restrict __src,
290 #elif defined GNULIB_POSIXCHECK
292 # if HAVE_RAW_DECL_STPNCPY
294 "use gnulib module stpncpy for portability");
298 #if defined GNULIB_POSIXCHECK
303 _GL_WARN_ON_USE (strchr,
"strchr cannot work correctly on character strings "
304 "in some multibyte locales - "
305 "use mbschr if you care about internationalization");
309 #if @GNULIB_STRCHRNUL@
310 # if @REPLACE_STRCHRNUL@
311 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
312 # define strchrnul rpl_strchrnul
318 (
const char *str,
int ch));
320 # if ! @HAVE_STRCHRNUL@
329 char *, (
char const *__s,
int __c_in),
330 char const *, (
char const *__s,
int __c_in));
332 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
333 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
339 #elif defined GNULIB_POSIXCHECK
341 # if HAVE_RAW_DECL_STRCHRNUL
343 "use gnulib module strchrnul for portability");
349 # if @REPLACE_STRDUP@
350 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
352 # define strdup rpl_strdup
357 # if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
361 # if !(@HAVE_DECL_STRDUP@ || defined strdup)
367 #elif defined GNULIB_POSIXCHECK
369 # if HAVE_RAW_DECL_STRDUP
371 "use gnulib module strdup for portability");
377 # if @REPLACE_STRNCAT@
378 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
380 # define strncat rpl_strncat
389 #elif defined GNULIB_POSIXCHECK
391 # if HAVE_RAW_DECL_STRNCAT
393 "use gnulib module strncat for portability");
399 # if @REPLACE_STRNDUP@
400 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
402 # define strndup rpl_strndup
408 # if ! @HAVE_DECL_STRNDUP@
415 #elif defined GNULIB_POSIXCHECK
417 # if HAVE_RAW_DECL_STRNDUP
419 "use gnulib module strndup for portability");
427 # if @REPLACE_STRNLEN@
428 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
430 # define strnlen rpl_strnlen
437 # if ! @HAVE_DECL_STRNLEN@
445 #elif defined GNULIB_POSIXCHECK
447 # if HAVE_RAW_DECL_STRNLEN
449 "use gnulib module strnlen for portability");
453 #if defined GNULIB_POSIXCHECK
460 _GL_WARN_ON_USE (strcspn,
"strcspn cannot work correctly on character strings "
461 "in multibyte locales - "
462 "use mbscspn if you care about internationalization");
467 # if ! @HAVE_STRPBRK@
476 char *, (
char const *__s,
char const *__accept),
477 const char *, (
char const *__s,
char const *__accept));
478 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
479 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
482 (
char const *__s,
char const *__accept));
486 # if defined GNULIB_POSIXCHECK
492 _GL_WARN_ON_USE (strpbrk,
"strpbrk cannot work correctly on character strings "
493 "in multibyte locales - "
494 "use mbspbrk if you care about internationalization");
496 #elif defined GNULIB_POSIXCHECK
498 # if HAVE_RAW_DECL_STRPBRK
500 "use gnulib module strpbrk for portability");
504 #if defined GNULIB_POSIXCHECK
509 _GL_WARN_ON_USE (strspn,
"strspn cannot work correctly on character strings "
510 "in multibyte locales - "
511 "use mbsspn if you care about internationalization");
514 #if defined GNULIB_POSIXCHECK
519 _GL_WARN_ON_USE (strrchr,
"strrchr cannot work correctly on character strings "
520 "in some multibyte locales - "
521 "use mbsrchr if you care about internationalization");
543 (
char **restrict __stringp,
char const *restrict __delim)
547 (
char **restrict __stringp,
char const *restrict __delim));
549 # if defined GNULIB_POSIXCHECK
551 _GL_WARN_ON_USE (strsep,
"strsep cannot work correctly on character strings "
552 "in multibyte locales - "
553 "use mbssep if you care about internationalization");
555 #elif defined GNULIB_POSIXCHECK
557 # if HAVE_RAW_DECL_STRSEP
559 "use gnulib module strsep for portability");
564 # if @REPLACE_STRSTR@
565 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
566 # define strstr rpl_strstr
568 _GL_FUNCDECL_RPL (strstr,
char *, (
const char *haystack,
const char *needle)
571 _GL_CXXALIAS_RPL (strstr,
char *, (
const char *haystack,
const char *needle));
577 char *, (
const char *haystack,
const char *needle),
578 const char *, (
const char *haystack,
const char *needle));
580 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
581 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
584 (
const char *haystack,
const char *needle));
588 #elif defined GNULIB_POSIXCHECK
595 _GL_WARN_ON_USE (strstr,
"strstr is quadratic on many systems, and cannot "
596 "work correctly on character strings in most "
597 "multibyte locales - "
598 "use mbsstr if you care about internationalization, "
599 "or use strstr if you care about speed");
604 #if @GNULIB_STRCASESTR@
605 # if @REPLACE_STRCASESTR@
606 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
607 # define strcasestr rpl_strcasestr
610 (
const char *haystack,
const char *needle)
614 (
const char *haystack,
const char *needle));
616 # if ! @HAVE_STRCASESTR@
618 (
const char *haystack,
const char *needle)
626 char *, (
const char *haystack,
const char *needle),
627 const char *, (
const char *haystack,
const char *needle));
629 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
630 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
633 (
const char *haystack,
const char *needle));
637 #elif defined GNULIB_POSIXCHECK
642 # if HAVE_RAW_DECL_STRCASESTR
643 _GL_WARN_ON_USE (strcasestr,
"strcasestr does work correctly on character "
644 "strings in multibyte locales - "
645 "use mbscasestr if you care about "
646 "internationalization, or use c-strcasestr if you want "
647 "a locale independent function");
673 #if @GNULIB_STRTOK_R@
674 # if @REPLACE_STRTOK_R@
675 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
677 # define strtok_r rpl_strtok_r
680 (
char *restrict s,
char const *restrict delim,
681 char **restrict save_ptr)
684 (
char *restrict s,
char const *restrict delim,
685 char **restrict save_ptr));
687 # if @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK
690 # if ! @HAVE_DECL_STRTOK_R@
692 (
char *restrict s,
char const *restrict delim,
693 char **restrict save_ptr)
697 (
char *restrict s,
char const *restrict delim,
698 char **restrict save_ptr));
701 # if defined GNULIB_POSIXCHECK
702 _GL_WARN_ON_USE (strtok_r,
"strtok_r cannot work correctly on character "
703 "strings in multibyte locales - "
704 "use mbstok_r if you care about internationalization");
706 #elif defined GNULIB_POSIXCHECK
708 # if HAVE_RAW_DECL_STRTOK_R
710 "use gnulib module strtok_r for portability");
725 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
726 # define mbslen rpl_mbslen
740 _GL_EXTERN_C size_t mbsnlen (
const char *
string,
size_t len)
750 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
751 # define mbschr rpl_mbschr
769 # if defined __hpux || defined __INTERIX
770 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
771 # define mbsrchr rpl_mbsrchr
789 _GL_EXTERN_C char * mbsstr (
const char *haystack,
const char *needle)
793 #if @GNULIB_MBSCASECMP@
804 #if @GNULIB_MBSNCASECMP@
814 _GL_EXTERN_C int mbsncasecmp (
const char *
s1,
const char *s2,
size_t n)
818 #if @GNULIB_MBSPCASECMP@
831 #if @GNULIB_MBSCASESTR@
837 _GL_EXTERN_C char * mbscasestr (
const char *haystack,
const char *needle)
847 _GL_EXTERN_C size_t mbscspn (
const char *
string,
const char *accept)
857 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
858 # define mbspbrk rpl_mbspbrk
862 _GL_CXXALIAS_RPL (mbspbrk,
char *, (
const char *
string,
const char *accept));
866 _GL_CXXALIAS_SYS (mbspbrk,
char *, (
const char *
string,
const char *accept));
877 _GL_EXTERN_C size_t mbsspn (
const char *
string,
const char *reject)
896 _GL_EXTERN_C char * mbssep (
char **stringp,
const char *delim)
900 #if @GNULIB_MBSTOK_R@
917 _GL_EXTERN_C char * mbstok_r (
char *
string,
const char *delim,
char **save_ptr)
922 #if @GNULIB_STRERROR@
923 # if @REPLACE_STRERROR@
924 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
926 # define strerror rpl_strerror
934 #elif defined GNULIB_POSIXCHECK
938 "use gnulib module strerror to guarantee non-NULL result");
943 #if @GNULIB_STRERROR_R@
944 # if @REPLACE_STRERROR_R@
945 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
947 # define strerror_r rpl_strerror_r
953 # if !@HAVE_DECL_STRERROR_R@
959 # if @HAVE_DECL_STRERROR_R@
962 #elif defined GNULIB_POSIXCHECK
964 # if HAVE_RAW_DECL_STRERROR_R
966 "use gnulib module strerror_r-posix for portability");
970 #if @GNULIB_STRSIGNAL@
971 # if @REPLACE_STRSIGNAL@
972 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
973 # define strsignal rpl_strsignal
978 # if ! @HAVE_DECL_STRSIGNAL@
986 #elif defined GNULIB_POSIXCHECK
988 # if HAVE_RAW_DECL_STRSIGNAL
990 "use gnulib module strsignal for portability");
994 #if @GNULIB_STRVERSCMP@
995 # if !@HAVE_STRVERSCMP@
1001 #elif defined GNULIB_POSIXCHECK
1003 # if HAVE_RAW_DECL_STRVERSCMP
1005 "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.