annotate lib/string.in.h @ 16366:bb182ee4a09d

maint: replace FSF snail-mail addresses with URLs * config/argz.mk, lib/accept4.c, lib/alignof.h, lib/alloca.in.h: * lib/alphasort.c, lib/arcfour.c, lib/arcfour.h, lib/arctwo.c: * lib/arctwo.h, lib/argz.c, lib/arpa_inet.in.h, lib/asnprintf.c: * lib/asprintf.c, lib/assert.in.h, lib/base32.c, lib/base32.h: * lib/base64.c, lib/base64.h, lib/c-ctype.c, lib/c-ctype.h: * lib/c-strcase.h, lib/c-strcasecmp.c, lib/c-strncasecmp.c: * lib/check-version.c, lib/check-version.h, lib/config.charset: * lib/ctype.in.h, lib/des.c, lib/des.h, lib/dup3.c, lib/errno.in.h: * lib/float+.h, lib/fnmatch.c, lib/fnmatch.in.h, lib/fnmatch_loop.c: * lib/fseeko.c, lib/gai_strerror.c, lib/gc-gnulib.c: * lib/gc-libgcrypt.c, lib/gc-pbkdf2-sha1.c, lib/gc.h: * lib/getaddrinfo.c, lib/getdelim.c, lib/getfilecon.c, lib/getline.c: * lib/getlogin_r.c, lib/getpass.c, lib/getpass.h, lib/gettext.h: * lib/gettimeofday.c, lib/glob.in.h, lib/glthread/cond.c: * lib/glthread/cond.h, lib/glthread/lock.c, lib/glthread/lock.h: * lib/glthread/thread.c, lib/glthread/thread.h: * lib/glthread/threadlib.c, lib/glthread/yield.h, lib/hmac-md5.c: * lib/hmac-sha1.c, lib/hmac.h, lib/iconv.c, lib/iconv.in.h: * lib/iconv_close.c, lib/iconv_open.c, lib/inet_ntop.c, lib/isfinite.c: * lib/isinf.c, lib/iswblank.c, lib/langinfo.in.h, lib/link.c: * lib/localcharset.c, lib/localcharset.h, lib/lseek.c, lib/malloc.c: * lib/malloca.c, lib/malloca.h, lib/md2.c, lib/md2.h, lib/md4.c: * lib/md4.h, lib/md5.c, lib/md5.h, lib/memmem.c, lib/mempcpy.c: * lib/memset.c, lib/memxor.c, lib/memxor.h, lib/minmax.h, lib/mktime.c: * lib/msvc-inval.c, lib/msvc-inval.h, lib/msvc-nothrow.c: * lib/msvc-nothrow.h, lib/netdb.in.h, lib/netinet_in.in.h, lib/nproc.c: * lib/nproc.h, lib/obstack_printf.c, lib/pathmax.h, lib/pipe.c: * lib/pipe2.c, lib/poll.c, lib/poll.in.h, lib/printf-args.c: * lib/printf-args.h, lib/printf-parse.c, lib/printf-parse.h: * lib/pselect.c, lib/pthread.in.h, lib/pty-private.h, lib/pty.in.h: * lib/read-file.c, lib/read-file.h, lib/ref-add.sin, lib/ref-del.sin: * lib/regcomp.c, lib/regex.c, lib/regex.h, lib/regex_internal.c: * lib/regex_internal.h, lib/regexec.c, lib/rijndael-alg-fst.c: * lib/rijndael-alg-fst.h, lib/rijndael-api-fst.c: * lib/rijndael-api-fst.h, lib/rint.c, lib/rintf.c, lib/rintl.c: * lib/round.c, lib/roundf.c, lib/roundl.c, lib/scandir.c, lib/select.c: * lib/sha1.c, lib/sha1.h, lib/size_max.h, lib/snprintf.c: * lib/stdalign.in.h, lib/stdarg.in.h, lib/stdbool.in.h: * lib/stddef.in.h, lib/stdint.in.h, lib/stdio.in.h, lib/str-kmp.h: * lib/str-two-way.h, lib/strcasecmp.c, lib/strcasestr.c, lib/strdup.c: * lib/striconv.c, lib/striconv.h, lib/string.in.h, lib/strings.in.h: * lib/strncasecmp.c, lib/strndup.c, lib/strnlen.c, lib/strpbrk.c: * lib/strptime.c, lib/strsep.c, lib/strstr.c, lib/strverscmp.c: * lib/sys_file.in.h, lib/sys_ioctl.in.h, lib/sys_select.in.h: * lib/sys_socket.in.h, lib/sys_stat.in.h, lib/sys_time.in.h: * lib/sys_times.in.h, lib/sys_types.in.h, lib/sys_uio.in.h: * lib/sys_utsname.in.h, lib/sys_wait.in.h, lib/tcgetsid.c: * lib/termios.in.h, lib/time.in.h, lib/time_r.c, lib/timegm.c: * lib/times.c, lib/unictype/3level.h, lib/unictype/3levelbit.h: * lib/unistd.in.h, lib/vasnprintf.c, lib/vasnprintf.h, lib/vasprintf.c: * lib/vsnprintf.c, lib/waitpid.c, lib/wchar.in.h, lib/wctype.in.h: * lib/xsize.h, tests/test-closein.c, tests/test-des.c: * tests/test-fclose.c, tests/test-fgetc.c, tests/test-filevercmp.c: * tests/test-fputc.c, tests/test-fread.c, tests/test-fwrite.c: * tests/test-gc-arcfour.c, tests/test-gc-arctwo.c, tests/test-gc-des.c: * tests/test-gc-hmac-md5.c, tests/test-gc-hmac-sha1.c: * tests/test-gc-md2.c, tests/test-gc-md4.c, tests/test-gc-md5.c: * tests/test-gc-pbkdf2-sha1.c, tests/test-gc-rijndael.c: * tests/test-gc-sha1.c, tests/test-gc.c, tests/test-getdelim.c: * tests/test-getline.c, tests/test-getndelim2.c, tests/test-md2.c: * tests/test-md4.c, tests/test-parse-datetime.c, tests/test-perror.c: * tests/test-perror2.c, tests/test-pipe.c, tests/test-pipe2.c: * tests/test-poll.c, tests/test-quotearg-simple.c: * tests/test-quotearg.c, tests/test-quotearg.h: * tests/test-round-ieee.c, tests/test-round1.c: * tests/test-roundf-ieee.c, tests/test-roundf1.c: * tests/test-roundl-ieee.c, tests/test-roundl.c: * tests/test-safe-alloc.c, tests/test-sigpipe.c: * tests/test-spawn-pipe-child.c, tests/test-spawn-pipe-main.c: * tests/test-strerror.c, tests/test-strerror_r.c: * tests/test-strsignal.c, tests/test-strverscmp.c: * tests/test-xmemdup0.c: Replace FSF snail mail addresses with URLs, as per GNU coding standards. See glibc bug <http://sourceware.org/bugzilla/show_bug.cgi?id=13673>.
author Paul Eggert <eggert@cs.ucla.edu>
date Thu, 09 Feb 2012 21:39:05 -0800 (2012-02-10)
parents 8250f2777afc
children be14d9f76493
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* A GNU-like <string.h>.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2
16201
8250f2777afc maint: update all copyright year number ranges
Jim Meyering <meyering@redhat.com>
parents: 15428
diff changeset
3 Copyright (C) 1995-1996, 2001-2012 Free Software Foundation, Inc.
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 This program is free software; you can redistribute it and/or modify
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 the Free Software Foundation; either version 2, or (at your option)
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 any later version.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 GNU General Public License for more details.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
16366
bb182ee4a09d maint: replace FSF snail-mail addresses with URLs
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
16 along with this program; if not, see <http://www.gnu.org/licenses/>. */
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17
14840
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14828
diff changeset
18 #ifndef _@GUARD_PREFIX@_STRING_H
13094
2ed0fc659db8 Emit #pragma system_header after the inclusion guard, not before.
Bruno Haible <bruno@clisp.org>
parents: 13055
diff changeset
19
10655
8668b19a7032 Avoid gcc warnings because of #pragma GCC system_header on older gcc.
Bruno Haible <bruno@clisp.org>
parents: 10456
diff changeset
20 #if __GNUC__ >= 3
10375
f96e845fc36d Avoid some "gcc -pedantic" warnings.
Bruno Haible <bruno@clisp.org>
parents: 10345
diff changeset
21 @PRAGMA_SYSTEM_HEADER@
10655
8668b19a7032 Avoid gcc warnings because of #pragma GCC system_header on older gcc.
Bruno Haible <bruno@clisp.org>
parents: 10456
diff changeset
22 #endif
13761
a19ace3ba849 Avoid line length limitation from HP NonStop system header files.
Bruno Haible <bruno@clisp.org>
parents: 13661
diff changeset
23 @PRAGMA_COLUMNS@
10375
f96e845fc36d Avoid some "gcc -pedantic" warnings.
Bruno Haible <bruno@clisp.org>
parents: 10345
diff changeset
24
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 /* The include_next requires a split double-inclusion guard. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 #@INCLUDE_NEXT@ @NEXT_STRING_H@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27
14840
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14828
diff changeset
28 #ifndef _@GUARD_PREFIX@_STRING_H
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14828
diff changeset
29 #define _@GUARD_PREFIX@_STRING_H
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30
11832
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents: 11624
diff changeset
31 /* NetBSD 5.0 mis-defines NULL. */
ff3dd373542b stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents: 11624
diff changeset
32 #include <stddef.h>
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33
12602
e6c17971ef92 mbslen: Avoid collision with system function.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
34 /* MirBSD defines mbslen as a macro. */
e6c17971ef92 mbslen: Avoid collision with system function.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
35 #if @GNULIB_MBSLEN@ && defined __MirBSD__
e6c17971ef92 mbslen: Avoid collision with system function.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
36 # include <wchar.h>
e6c17971ef92 mbslen: Avoid collision with system function.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
37 #endif
e6c17971ef92 mbslen: Avoid collision with system function.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
38
14343
8e4360837451 Don't interfere with a program's definition of __attribute__.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
39 /* The __attribute__ feature is available in gcc versions 2.5 and later.
8e4360837451 Don't interfere with a program's definition of __attribute__.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
40 The attribute __pure__ was added in gcc 2.96. */
13443
6c32722a9d4b string: Fix syntax error with g++ 2.96.
Bruno Haible <bruno@clisp.org>
parents: 13194
diff changeset
41 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
6c32722a9d4b string: Fix syntax error with g++ 2.96.
Bruno Haible <bruno@clisp.org>
parents: 13194
diff changeset
42 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
6c32722a9d4b string: Fix syntax error with g++ 2.96.
Bruno Haible <bruno@clisp.org>
parents: 13194
diff changeset
43 #else
6c32722a9d4b string: Fix syntax error with g++ 2.96.
Bruno Haible <bruno@clisp.org>
parents: 13194
diff changeset
44 # define _GL_ATTRIBUTE_PURE /* empty */
9590
246fc6fd3787 Give gcc some memmem optimization hints.
Eric Blake <ebb9@byu.net>
parents: 9538
diff changeset
45 #endif
246fc6fd3787 Give gcc some memmem optimization hints.
Eric Blake <ebb9@byu.net>
parents: 9538
diff changeset
46
13661
e1c46598fd57 strsignal: work around NetBSD bug
Eric Blake <eblake@redhat.com>
parents: 13628
diff changeset
47 /* NetBSD 5.0 declares strsignal in <unistd.h>, not in <string.h>. */
13773
d06d8f66d2bd string, sys_select: Avoid #including large headers unless necessary.
Bruno Haible <bruno@clisp.org>
parents: 13761
diff changeset
48 /* But in any case avoid namespace pollution on glibc systems. */
d06d8f66d2bd string, sys_select: Avoid #including large headers unless necessary.
Bruno Haible <bruno@clisp.org>
parents: 13761
diff changeset
49 #if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \
13661
e1c46598fd57 strsignal: work around NetBSD bug
Eric Blake <eblake@redhat.com>
parents: 13628
diff changeset
50 && ! defined __GLIBC__
e1c46598fd57 strsignal: work around NetBSD bug
Eric Blake <eblake@redhat.com>
parents: 13628
diff changeset
51 # include <unistd.h>
e1c46598fd57 strsignal: work around NetBSD bug
Eric Blake <eblake@redhat.com>
parents: 13628
diff changeset
52 #endif
9590
246fc6fd3787 Give gcc some memmem optimization hints.
Eric Blake <ebb9@byu.net>
parents: 9538
diff changeset
53
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
54 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
55
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
56 /* The definition of _GL_ARG_NONNULL is copied here. */
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
57
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
58 /* The definition of _GL_WARN_ON_USE is copied here. */
12422
f7842310a565 New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
59
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
60
15428
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
61 /* Find the index of the least-significant set bit. */
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
62 #if @GNULIB_FFSL@
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
63 # if !@HAVE_FFSL@
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
64 _GL_FUNCDECL_SYS (ffsl, int, (long int i));
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
65 # endif
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
66 _GL_CXXALIAS_SYS (ffsl, int, (long int i));
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
67 _GL_CXXALIASWARN (ffsl);
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
68 #elif defined GNULIB_POSIXCHECK
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
69 # undef ffsl
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
70 # if HAVE_RAW_DECL_FFSL
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
71 _GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module");
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
72 # endif
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
73 #endif
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
74
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
75
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
76 /* Find the index of the least-significant set bit. */
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
77 #if @GNULIB_FFSLL@
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
78 # if !@HAVE_FFSLL@
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
79 _GL_FUNCDECL_SYS (ffsll, int, (long long int i));
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
80 # endif
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
81 _GL_CXXALIAS_SYS (ffsll, int, (long long int i));
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
82 _GL_CXXALIASWARN (ffsll);
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
83 #elif defined GNULIB_POSIXCHECK
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
84 # undef ffsll
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
85 # if HAVE_RAW_DECL_FFSLL
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
86 _GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module");
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
87 # endif
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
88 #endif
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
89
4e3a37b1ceae ffsl, ffsll: new modules
Eric Blake <eblake@redhat.com>
parents: 14840
diff changeset
90
11621
c98fca1ff8b8 memchr: detect broken x86_64 and alpha implementations
Eric Blake <ebb9@byu.net>
parents: 10655
diff changeset
91 /* Return the first instance of C within N bytes of S, or NULL. */
c98fca1ff8b8 memchr: detect broken x86_64 and alpha implementations
Eric Blake <ebb9@byu.net>
parents: 10655
diff changeset
92 #if @GNULIB_MEMCHR@
c98fca1ff8b8 memchr: detect broken x86_64 and alpha implementations
Eric Blake <ebb9@byu.net>
parents: 10655
diff changeset
93 # if @REPLACE_MEMCHR@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
94 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
95 # define memchr rpl_memchr
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
96 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
97 _GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n)
13443
6c32722a9d4b string: Fix syntax error with g++ 2.96.
Bruno Haible <bruno@clisp.org>
parents: 13194
diff changeset
98 _GL_ATTRIBUTE_PURE
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
99 _GL_ARG_NONNULL ((1)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
100 _GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
101 # else
13161
c4c537d4c2f0 memchr: Avoid a possible C++ test error.
Bruno Haible <bruno@clisp.org>
parents: 13119
diff changeset
102 # if ! @HAVE_MEMCHR@
c4c537d4c2f0 memchr: Avoid a possible C++ test error.
Bruno Haible <bruno@clisp.org>
parents: 13119
diff changeset
103 _GL_FUNCDECL_SYS (memchr, void *, (void const *__s, int __c, size_t __n)
13443
6c32722a9d4b string: Fix syntax error with g++ 2.96.
Bruno Haible <bruno@clisp.org>
parents: 13194
diff changeset
104 _GL_ATTRIBUTE_PURE
13161
c4c537d4c2f0 memchr: Avoid a possible C++ test error.
Bruno Haible <bruno@clisp.org>
parents: 13119
diff changeset
105 _GL_ARG_NONNULL ((1)));
c4c537d4c2f0 memchr: Avoid a possible C++ test error.
Bruno Haible <bruno@clisp.org>
parents: 13119
diff changeset
106 # endif
12980
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
107 /* On some systems, this function is defined as an overloaded function:
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
108 extern "C" { const void * std::memchr (const void *, int, size_t); }
12980
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
109 extern "C++" { void * std::memchr (void *, int, size_t); } */
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
110 _GL_CXXALIAS_SYS_CAST2 (memchr,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
111 void *, (void const *__s, int __c, size_t __n),
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
112 void const *, (void const *__s, int __c, size_t __n));
11621
c98fca1ff8b8 memchr: detect broken x86_64 and alpha implementations
Eric Blake <ebb9@byu.net>
parents: 10655
diff changeset
113 # endif
13885
87a95303747f Port to uClibc.
Bruno Haible <bruno@clisp.org>
parents: 13847
diff changeset
114 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
12984
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
115 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
116 _GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n));
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
117 _GL_CXXALIASWARN1 (memchr, void const *,
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
118 (void const *__s, int __c, size_t __n));
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
119 # else
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
120 _GL_CXXALIASWARN (memchr);
12984
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
121 # endif
11621
c98fca1ff8b8 memchr: detect broken x86_64 and alpha implementations
Eric Blake <ebb9@byu.net>
parents: 10655
diff changeset
122 #elif defined GNULIB_POSIXCHECK
c98fca1ff8b8 memchr: detect broken x86_64 and alpha implementations
Eric Blake <ebb9@byu.net>
parents: 10655
diff changeset
123 # undef memchr
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
124 /* Assume memchr is always declared. */
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
125 _GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
126 "use gnulib module memchr for portability" );
11621
c98fca1ff8b8 memchr: detect broken x86_64 and alpha implementations
Eric Blake <ebb9@byu.net>
parents: 10655
diff changeset
127 #endif
c98fca1ff8b8 memchr: detect broken x86_64 and alpha implementations
Eric Blake <ebb9@byu.net>
parents: 10655
diff changeset
128
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
129 /* Return the first occurrence of NEEDLE in HAYSTACK. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
130 #if @GNULIB_MEMMEM@
9538
43d9769bf4d0 Fix memmem to avoid O(n^2) worst-case complexity.
Eric Blake <ebb9@byu.net>
parents: 9496
diff changeset
131 # if @REPLACE_MEMMEM@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
132 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
133 # define memmem rpl_memmem
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
134 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
135 _GL_FUNCDECL_RPL (memmem, void *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
136 (void const *__haystack, size_t __haystack_len,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
137 void const *__needle, size_t __needle_len)
13443
6c32722a9d4b string: Fix syntax error with g++ 2.96.
Bruno Haible <bruno@clisp.org>
parents: 13194
diff changeset
138 _GL_ATTRIBUTE_PURE
6c32722a9d4b string: Fix syntax error with g++ 2.96.
Bruno Haible <bruno@clisp.org>
parents: 13194
diff changeset
139 _GL_ARG_NONNULL ((1, 3)));
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
140 _GL_CXXALIAS_RPL (memmem, void *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
141 (void const *__haystack, size_t __haystack_len,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
142 void const *__needle, size_t __needle_len));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
143 # else
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
144 # if ! @HAVE_DECL_MEMMEM@
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
145 _GL_FUNCDECL_SYS (memmem, void *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
146 (void const *__haystack, size_t __haystack_len,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
147 void const *__needle, size_t __needle_len)
13443
6c32722a9d4b string: Fix syntax error with g++ 2.96.
Bruno Haible <bruno@clisp.org>
parents: 13194
diff changeset
148 _GL_ATTRIBUTE_PURE
6c32722a9d4b string: Fix syntax error with g++ 2.96.
Bruno Haible <bruno@clisp.org>
parents: 13194
diff changeset
149 _GL_ARG_NONNULL ((1, 3)));
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
150 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
151 _GL_CXXALIAS_SYS (memmem, void *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
152 (void const *__haystack, size_t __haystack_len,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
153 void const *__needle, size_t __needle_len));
9538
43d9769bf4d0 Fix memmem to avoid O(n^2) worst-case complexity.
Eric Blake <ebb9@byu.net>
parents: 9496
diff changeset
154 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
155 _GL_CXXALIASWARN (memmem);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
156 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
157 # undef memmem
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
158 # if HAVE_RAW_DECL_MEMMEM
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
159 _GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
160 "use gnulib module memmem-simple for portability, "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
161 "and module memmem for speed" );
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
162 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
163 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
164
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
165 /* Copy N bytes of SRC to DEST, return pointer to bytes after the
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
166 last written byte. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
167 #if @GNULIB_MEMPCPY@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
168 # if ! @HAVE_MEMPCPY@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
169 _GL_FUNCDECL_SYS (mempcpy, void *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
170 (void *restrict __dest, void const *restrict __src,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
171 size_t __n)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
172 _GL_ARG_NONNULL ((1, 2)));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
173 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
174 _GL_CXXALIAS_SYS (mempcpy, void *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
175 (void *restrict __dest, void const *restrict __src,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
176 size_t __n));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
177 _GL_CXXALIASWARN (mempcpy);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
178 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
179 # undef mempcpy
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
180 # if HAVE_RAW_DECL_MEMPCPY
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
181 _GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
182 "use gnulib module mempcpy for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
183 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
184 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
185
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
186 /* Search backwards through a block for a byte (specified as an int). */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
187 #if @GNULIB_MEMRCHR@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
188 # if ! @HAVE_DECL_MEMRCHR@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
189 _GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t)
13443
6c32722a9d4b string: Fix syntax error with g++ 2.96.
Bruno Haible <bruno@clisp.org>
parents: 13194
diff changeset
190 _GL_ATTRIBUTE_PURE
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
191 _GL_ARG_NONNULL ((1)));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
192 # endif
12980
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
193 /* On some systems, this function is defined as an overloaded function:
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
194 extern "C++" { const void * std::memrchr (const void *, int, size_t); }
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
195 extern "C++" { void * std::memrchr (void *, int, size_t); } */
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
196 _GL_CXXALIAS_SYS_CAST2 (memrchr,
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
197 void *, (void const *, int, size_t),
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
198 void const *, (void const *, int, size_t));
13885
87a95303747f Port to uClibc.
Bruno Haible <bruno@clisp.org>
parents: 13847
diff changeset
199 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
12984
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
200 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
201 _GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t));
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
202 _GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t));
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
203 # else
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
204 _GL_CXXALIASWARN (memrchr);
12984
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
205 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
206 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
207 # undef memrchr
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
208 # if HAVE_RAW_DECL_MEMRCHR
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
209 _GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
210 "use gnulib module memrchr for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
211 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
212 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
213
9999
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
214 /* Find the first occurrence of C in S. More efficient than
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
215 memchr(S,C,N), at the expense of undefined behavior if C does not
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
216 occur within N bytes. */
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
217 #if @GNULIB_RAWMEMCHR@
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
218 # if ! @HAVE_RAWMEMCHR@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
219 _GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in)
13443
6c32722a9d4b string: Fix syntax error with g++ 2.96.
Bruno Haible <bruno@clisp.org>
parents: 13194
diff changeset
220 _GL_ATTRIBUTE_PURE
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
221 _GL_ARG_NONNULL ((1)));
9999
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
222 # endif
12980
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
223 /* On some systems, this function is defined as an overloaded function:
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
224 extern "C++" { const void * std::rawmemchr (const void *, int); }
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
225 extern "C++" { void * std::rawmemchr (void *, int); } */
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
226 _GL_CXXALIAS_SYS_CAST2 (rawmemchr,
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
227 void *, (void const *__s, int __c_in),
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
228 void const *, (void const *__s, int __c_in));
13885
87a95303747f Port to uClibc.
Bruno Haible <bruno@clisp.org>
parents: 13847
diff changeset
229 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
12984
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
230 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
231 _GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in));
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
232 _GL_CXXALIASWARN1 (rawmemchr, void const *, (void const *__s, int __c_in));
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
233 # else
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
234 _GL_CXXALIASWARN (rawmemchr);
12984
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
235 # endif
9999
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
236 #elif defined GNULIB_POSIXCHECK
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
237 # undef rawmemchr
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
238 # if HAVE_RAW_DECL_RAWMEMCHR
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
239 _GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
240 "use gnulib module rawmemchr for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
241 # endif
9999
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
242 #endif
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
243
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
244 /* Copy SRC to DST, returning the address of the terminating '\0' in DST. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
245 #if @GNULIB_STPCPY@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
246 # if ! @HAVE_STPCPY@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
247 _GL_FUNCDECL_SYS (stpcpy, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
248 (char *restrict __dst, char const *restrict __src)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
249 _GL_ARG_NONNULL ((1, 2)));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
250 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
251 _GL_CXXALIAS_SYS (stpcpy, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
252 (char *restrict __dst, char const *restrict __src));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
253 _GL_CXXALIASWARN (stpcpy);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
254 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
255 # undef stpcpy
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
256 # if HAVE_RAW_DECL_STPCPY
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
257 _GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
258 "use gnulib module stpcpy for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
259 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
260 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
261
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
262 /* Copy no more than N bytes of SRC to DST, returning a pointer past the
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
263 last non-NUL byte written into DST. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
264 #if @GNULIB_STPNCPY@
13119
5fa4ec4a6e8b stpncpy: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents: 13094
diff changeset
265 # if @REPLACE_STPNCPY@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
266 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
13558
263949fe34ae stpncpy: Allow stpncpy to be defined as a macro.
Bruno Haible <bruno@clisp.org>
parents: 13478
diff changeset
267 # undef stpncpy
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
268 # define stpncpy rpl_stpncpy
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
269 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
270 _GL_FUNCDECL_RPL (stpncpy, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
271 (char *restrict __dst, char const *restrict __src,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
272 size_t __n)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
273 _GL_ARG_NONNULL ((1, 2)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
274 _GL_CXXALIAS_RPL (stpncpy, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
275 (char *restrict __dst, char const *restrict __src,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
276 size_t __n));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
277 # else
13119
5fa4ec4a6e8b stpncpy: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents: 13094
diff changeset
278 # if ! @HAVE_STPNCPY@
5fa4ec4a6e8b stpncpy: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents: 13094
diff changeset
279 _GL_FUNCDECL_SYS (stpncpy, char *,
5fa4ec4a6e8b stpncpy: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents: 13094
diff changeset
280 (char *restrict __dst, char const *restrict __src,
5fa4ec4a6e8b stpncpy: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents: 13094
diff changeset
281 size_t __n)
5fa4ec4a6e8b stpncpy: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents: 13094
diff changeset
282 _GL_ARG_NONNULL ((1, 2)));
5fa4ec4a6e8b stpncpy: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents: 13094
diff changeset
283 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
284 _GL_CXXALIAS_SYS (stpncpy, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
285 (char *restrict __dst, char const *restrict __src,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
286 size_t __n));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
287 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
288 _GL_CXXALIASWARN (stpncpy);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
289 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
290 # undef stpncpy
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
291 # if HAVE_RAW_DECL_STPNCPY
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
292 _GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
293 "use gnulib module stpncpy for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
294 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
295 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
296
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
297 #if defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
298 /* strchr() does not work with multibyte strings if the locale encoding is
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
299 GB18030 and the character to be searched is a digit. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
300 # undef strchr
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
301 /* Assume strchr is always declared. */
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
302 _GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
303 "in some multibyte locales - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
304 "use mbschr if you care about internationalization");
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
305 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
306
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
307 /* Find the first occurrence of C in S or the final NUL byte. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
308 #if @GNULIB_STRCHRNUL@
14585
1eab1082a832 strchrnul: work around cygwin bug
Eric Blake <eblake@redhat.com>
parents: 14343
diff changeset
309 # if @REPLACE_STRCHRNUL@
1eab1082a832 strchrnul: work around cygwin bug
Eric Blake <eblake@redhat.com>
parents: 14343
diff changeset
310 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1eab1082a832 strchrnul: work around cygwin bug
Eric Blake <eblake@redhat.com>
parents: 14343
diff changeset
311 # define strchrnul rpl_strchrnul
1eab1082a832 strchrnul: work around cygwin bug
Eric Blake <eblake@redhat.com>
parents: 14343
diff changeset
312 # endif
14586
e60c0a94bedd strchrnul: Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 14585
diff changeset
313 _GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in)
e60c0a94bedd strchrnul: Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 14585
diff changeset
314 _GL_ATTRIBUTE_PURE
e60c0a94bedd strchrnul: Tweak last commit.
Bruno Haible <bruno@clisp.org>
parents: 14585
diff changeset
315 _GL_ARG_NONNULL ((1)));
14585
1eab1082a832 strchrnul: work around cygwin bug
Eric Blake <eblake@redhat.com>
parents: 14343
diff changeset
316 _GL_CXXALIAS_RPL (strchrnul, char *,
1eab1082a832 strchrnul: work around cygwin bug
Eric Blake <eblake@redhat.com>
parents: 14343
diff changeset
317 (const char *str, int ch));
1eab1082a832 strchrnul: work around cygwin bug
Eric Blake <eblake@redhat.com>
parents: 14343
diff changeset
318 # else
1eab1082a832 strchrnul: work around cygwin bug
Eric Blake <eblake@redhat.com>
parents: 14343
diff changeset
319 # if ! @HAVE_STRCHRNUL@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
320 _GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in)
13443
6c32722a9d4b string: Fix syntax error with g++ 2.96.
Bruno Haible <bruno@clisp.org>
parents: 13194
diff changeset
321 _GL_ATTRIBUTE_PURE
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
322 _GL_ARG_NONNULL ((1)));
14585
1eab1082a832 strchrnul: work around cygwin bug
Eric Blake <eblake@redhat.com>
parents: 14343
diff changeset
323 # endif
12980
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
324 /* On some systems, this function is defined as an overloaded function:
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
325 extern "C++" { const char * std::strchrnul (const char *, int); }
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
326 extern "C++" { char * std::strchrnul (char *, int); } */
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
327 _GL_CXXALIAS_SYS_CAST2 (strchrnul,
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
328 char *, (char const *__s, int __c_in),
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
329 char const *, (char const *__s, int __c_in));
14585
1eab1082a832 strchrnul: work around cygwin bug
Eric Blake <eblake@redhat.com>
parents: 14343
diff changeset
330 # endif
13885
87a95303747f Port to uClibc.
Bruno Haible <bruno@clisp.org>
parents: 13847
diff changeset
331 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
12984
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
332 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
333 _GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in));
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
334 _GL_CXXALIASWARN1 (strchrnul, char const *, (char const *__s, int __c_in));
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
335 # else
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
336 _GL_CXXALIASWARN (strchrnul);
12984
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
337 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
338 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
339 # undef strchrnul
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
340 # if HAVE_RAW_DECL_STRCHRNUL
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
341 _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
342 "use gnulib module strchrnul for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
343 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
344 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
345
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
346 /* Duplicate S, returning an identical malloc'd string. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
347 #if @GNULIB_STRDUP@
10456
a821fdd7b2b7 New module 'strdup-posix'.
Bruno Haible <bruno@clisp.org>
parents: 10375
diff changeset
348 # if @REPLACE_STRDUP@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
349 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
350 # undef strdup
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
351 # define strdup rpl_strdup
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
352 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
353 _GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
354 _GL_CXXALIAS_RPL (strdup, char *, (char const *__s));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
355 # else
13628
b8b731ae72a8 strdup: Fix compilation error in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 13558
diff changeset
356 # if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
b8b731ae72a8 strdup: Fix compilation error in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 13558
diff changeset
357 /* strdup exists as a function and as a macro. Get rid of the macro. */
b8b731ae72a8 strdup: Fix compilation error in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 13558
diff changeset
358 # undef strdup
b8b731ae72a8 strdup: Fix compilation error in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 13558
diff changeset
359 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
360 # if !(@HAVE_DECL_STRDUP@ || defined strdup)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
361 _GL_FUNCDECL_SYS (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
362 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
363 _GL_CXXALIAS_SYS (strdup, char *, (char const *__s));
10456
a821fdd7b2b7 New module 'strdup-posix'.
Bruno Haible <bruno@clisp.org>
parents: 10375
diff changeset
364 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
365 _GL_CXXALIASWARN (strdup);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
366 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
367 # undef strdup
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
368 # if HAVE_RAW_DECL_STRDUP
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
369 _GL_WARN_ON_USE (strdup, "strdup is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
370 "use gnulib module strdup for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
371 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
372 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
373
13175
5e6286661cc0 New module 'strncat'.
Bruno Haible <bruno@clisp.org>
parents: 13161
diff changeset
374 /* Append no more than N characters from SRC onto DEST. */
5e6286661cc0 New module 'strncat'.
Bruno Haible <bruno@clisp.org>
parents: 13161
diff changeset
375 #if @GNULIB_STRNCAT@
5e6286661cc0 New module 'strncat'.
Bruno Haible <bruno@clisp.org>
parents: 13161
diff changeset
376 # if @REPLACE_STRNCAT@
5e6286661cc0 New module 'strncat'.
Bruno Haible <bruno@clisp.org>
parents: 13161
diff changeset
377 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
5e6286661cc0 New module 'strncat'.
Bruno Haible <bruno@clisp.org>
parents: 13161
diff changeset
378 # undef strncat
5e6286661cc0 New module 'strncat'.
Bruno Haible <bruno@clisp.org>
parents: 13161
diff changeset
379 # define strncat rpl_strncat
5e6286661cc0 New module 'strncat'.
Bruno Haible <bruno@clisp.org>
parents: 13161
diff changeset
380 # endif
5e6286661cc0 New module 'strncat'.
Bruno Haible <bruno@clisp.org>
parents: 13161
diff changeset
381 _GL_FUNCDECL_RPL (strncat, char *, (char *dest, const char *src, size_t n)
5e6286661cc0 New module 'strncat'.
Bruno Haible <bruno@clisp.org>
parents: 13161
diff changeset
382 _GL_ARG_NONNULL ((1, 2)));
5e6286661cc0 New module 'strncat'.
Bruno Haible <bruno@clisp.org>
parents: 13161
diff changeset
383 _GL_CXXALIAS_RPL (strncat, char *, (char *dest, const char *src, size_t n));
5e6286661cc0 New module 'strncat'.
Bruno Haible <bruno@clisp.org>
parents: 13161
diff changeset
384 # else
5e6286661cc0 New module 'strncat'.
Bruno Haible <bruno@clisp.org>
parents: 13161
diff changeset
385 _GL_CXXALIAS_SYS (strncat, char *, (char *dest, const char *src, size_t n));
5e6286661cc0 New module 'strncat'.
Bruno Haible <bruno@clisp.org>
parents: 13161
diff changeset
386 # endif
5e6286661cc0 New module 'strncat'.
Bruno Haible <bruno@clisp.org>
parents: 13161
diff changeset
387 _GL_CXXALIASWARN (strncat);
5e6286661cc0 New module 'strncat'.
Bruno Haible <bruno@clisp.org>
parents: 13161
diff changeset
388 #elif defined GNULIB_POSIXCHECK
5e6286661cc0 New module 'strncat'.
Bruno Haible <bruno@clisp.org>
parents: 13161
diff changeset
389 # undef strncat
5e6286661cc0 New module 'strncat'.
Bruno Haible <bruno@clisp.org>
parents: 13161
diff changeset
390 # if HAVE_RAW_DECL_STRNCAT
5e6286661cc0 New module 'strncat'.
Bruno Haible <bruno@clisp.org>
parents: 13161
diff changeset
391 _GL_WARN_ON_USE (strncat, "strncat is unportable - "
5e6286661cc0 New module 'strncat'.
Bruno Haible <bruno@clisp.org>
parents: 13161
diff changeset
392 "use gnulib module strncat for portability");
5e6286661cc0 New module 'strncat'.
Bruno Haible <bruno@clisp.org>
parents: 13161
diff changeset
393 # endif
5e6286661cc0 New module 'strncat'.
Bruno Haible <bruno@clisp.org>
parents: 13161
diff changeset
394 #endif
5e6286661cc0 New module 'strncat'.
Bruno Haible <bruno@clisp.org>
parents: 13161
diff changeset
395
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
396 /* Return a newly allocated copy of at most N bytes of STRING. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
397 #if @GNULIB_STRNDUP@
11983
5f256f637c47 strndup: fix improper m4 caching
Eric Blake <ebb9@byu.net>
parents: 11960
diff changeset
398 # if @REPLACE_STRNDUP@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
399 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
400 # undef strndup
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
401 # define strndup rpl_strndup
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
402 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
403 _GL_FUNCDECL_RPL (strndup, char *, (char const *__string, size_t __n)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
404 _GL_ARG_NONNULL ((1)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
405 _GL_CXXALIAS_RPL (strndup, char *, (char const *__string, size_t __n));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
406 # else
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
407 # if ! @HAVE_DECL_STRNDUP@
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
408 _GL_FUNCDECL_SYS (strndup, char *, (char const *__string, size_t __n)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
409 _GL_ARG_NONNULL ((1)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
410 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
411 _GL_CXXALIAS_SYS (strndup, char *, (char const *__string, size_t __n));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
412 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
413 _GL_CXXALIASWARN (strndup);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
414 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
415 # undef strndup
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
416 # if HAVE_RAW_DECL_STRNDUP
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
417 _GL_WARN_ON_USE (strndup, "strndup is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
418 "use gnulib module strndup for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
419 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
420 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
421
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
422 /* Find the length (number of bytes) of STRING, but scan at most
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
423 MAXLEN bytes. If no '\0' terminator is found in that many bytes,
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
424 return MAXLEN. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
425 #if @GNULIB_STRNLEN@
13194
5aec4f35399f strnlen: Fix warning in C++ mode on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 13175
diff changeset
426 # if @REPLACE_STRNLEN@
5aec4f35399f strnlen: Fix warning in C++ mode on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 13175
diff changeset
427 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
5aec4f35399f strnlen: Fix warning in C++ mode on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 13175
diff changeset
428 # undef strnlen
5aec4f35399f strnlen: Fix warning in C++ mode on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 13175
diff changeset
429 # define strnlen rpl_strnlen
5aec4f35399f strnlen: Fix warning in C++ mode on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 13175
diff changeset
430 # endif
5aec4f35399f strnlen: Fix warning in C++ mode on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 13175
diff changeset
431 _GL_FUNCDECL_RPL (strnlen, size_t, (char const *__string, size_t __maxlen)
13443
6c32722a9d4b string: Fix syntax error with g++ 2.96.
Bruno Haible <bruno@clisp.org>
parents: 13194
diff changeset
432 _GL_ATTRIBUTE_PURE
13194
5aec4f35399f strnlen: Fix warning in C++ mode on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 13175
diff changeset
433 _GL_ARG_NONNULL ((1)));
5aec4f35399f strnlen: Fix warning in C++ mode on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 13175
diff changeset
434 _GL_CXXALIAS_RPL (strnlen, size_t, (char const *__string, size_t __maxlen));
5aec4f35399f strnlen: Fix warning in C++ mode on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 13175
diff changeset
435 # else
5aec4f35399f strnlen: Fix warning in C++ mode on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 13175
diff changeset
436 # if ! @HAVE_DECL_STRNLEN@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
437 _GL_FUNCDECL_SYS (strnlen, size_t, (char const *__string, size_t __maxlen)
13443
6c32722a9d4b string: Fix syntax error with g++ 2.96.
Bruno Haible <bruno@clisp.org>
parents: 13194
diff changeset
438 _GL_ATTRIBUTE_PURE
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
439 _GL_ARG_NONNULL ((1)));
13194
5aec4f35399f strnlen: Fix warning in C++ mode on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 13175
diff changeset
440 # endif
5aec4f35399f strnlen: Fix warning in C++ mode on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 13175
diff changeset
441 _GL_CXXALIAS_SYS (strnlen, size_t, (char const *__string, size_t __maxlen));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
442 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
443 _GL_CXXALIASWARN (strnlen);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
444 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
445 # undef strnlen
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
446 # if HAVE_RAW_DECL_STRNLEN
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
447 _GL_WARN_ON_USE (strnlen, "strnlen is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
448 "use gnulib module strnlen for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
449 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
450 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
451
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
452 #if defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
453 /* strcspn() assumes the second argument is a list of single-byte characters.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
454 Even in this simple case, it does not work with multibyte strings if the
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
455 locale encoding is GB18030 and one of the characters to be searched is a
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
456 digit. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
457 # undef strcspn
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
458 /* Assume strcspn is always declared. */
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
459 _GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
460 "in multibyte locales - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
461 "use mbscspn if you care about internationalization");
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
462 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
463
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
464 /* Find the first occurrence in S of any character in ACCEPT. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
465 #if @GNULIB_STRPBRK@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
466 # if ! @HAVE_STRPBRK@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
467 _GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept)
13443
6c32722a9d4b string: Fix syntax error with g++ 2.96.
Bruno Haible <bruno@clisp.org>
parents: 13194
diff changeset
468 _GL_ATTRIBUTE_PURE
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
469 _GL_ARG_NONNULL ((1, 2)));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
470 # endif
12980
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
471 /* On some systems, this function is defined as an overloaded function:
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
472 extern "C" { const char * strpbrk (const char *, const char *); }
12980
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
473 extern "C++" { char * strpbrk (char *, const char *); } */
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
474 _GL_CXXALIAS_SYS_CAST2 (strpbrk,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
475 char *, (char const *__s, char const *__accept),
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
476 const char *, (char const *__s, char const *__accept));
13885
87a95303747f Port to uClibc.
Bruno Haible <bruno@clisp.org>
parents: 13847
diff changeset
477 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
12984
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
478 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
479 _GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept));
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
480 _GL_CXXALIASWARN1 (strpbrk, char const *,
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
481 (char const *__s, char const *__accept));
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
482 # else
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
483 _GL_CXXALIASWARN (strpbrk);
12984
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
484 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
485 # if defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
486 /* strpbrk() assumes the second argument is a list of single-byte characters.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
487 Even in this simple case, it does not work with multibyte strings if the
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
488 locale encoding is GB18030 and one of the characters to be searched is a
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
489 digit. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
490 # undef strpbrk
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
491 _GL_WARN_ON_USE (strpbrk, "strpbrk cannot work correctly on character strings "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
492 "in multibyte locales - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
493 "use mbspbrk if you care about internationalization");
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
494 # endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
495 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
496 # undef strpbrk
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
497 # if HAVE_RAW_DECL_STRPBRK
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
498 _GL_WARN_ON_USE (strpbrk, "strpbrk is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
499 "use gnulib module strpbrk for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
500 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
501 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
502
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
503 #if defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
504 /* strspn() assumes the second argument is a list of single-byte characters.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
505 Even in this simple case, it cannot work with multibyte strings. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
506 # undef strspn
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
507 /* Assume strspn is always declared. */
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
508 _GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
509 "in multibyte locales - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
510 "use mbsspn if you care about internationalization");
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
511 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
512
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
513 #if defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
514 /* strrchr() does not work with multibyte strings if the locale encoding is
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
515 GB18030 and the character to be searched is a digit. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
516 # undef strrchr
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
517 /* Assume strrchr is always declared. */
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
518 _GL_WARN_ON_USE (strrchr, "strrchr cannot work correctly on character strings "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
519 "in some multibyte locales - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
520 "use mbsrchr if you care about internationalization");
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
521 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
522
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
523 /* Search the next delimiter (char listed in DELIM) starting at *STRINGP.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
524 If one is found, overwrite it with a NUL, and advance *STRINGP
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
525 to point to the next char after it. Otherwise, set *STRINGP to NULL.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
526 If *STRINGP was already NULL, nothing happens.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
527 Return the old value of *STRINGP.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
528
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
529 This is a variant of strtok() that is multithread-safe and supports
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
530 empty fields.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
531
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
532 Caveat: It modifies the original string.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
533 Caveat: These functions cannot be used on constant strings.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
534 Caveat: The identity of the delimiting character is lost.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
535 Caveat: It doesn't work with multibyte strings unless all of the delimiter
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
536 characters are ASCII characters < 0x30.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
537
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
538 See also strtok_r(). */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
539 #if @GNULIB_STRSEP@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
540 # if ! @HAVE_STRSEP@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
541 _GL_FUNCDECL_SYS (strsep, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
542 (char **restrict __stringp, char const *restrict __delim)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
543 _GL_ARG_NONNULL ((1, 2)));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
544 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
545 _GL_CXXALIAS_SYS (strsep, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
546 (char **restrict __stringp, char const *restrict __delim));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
547 _GL_CXXALIASWARN (strsep);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
548 # if defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
549 # undef strsep
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
550 _GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
551 "in multibyte locales - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
552 "use mbssep if you care about internationalization");
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
553 # endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
554 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
555 # undef strsep
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
556 # if HAVE_RAW_DECL_STRSEP
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
557 _GL_WARN_ON_USE (strsep, "strsep is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
558 "use gnulib module strsep for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
559 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
560 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
561
9600
99268e709d31 Avoid quadratic strstr implementations.
Eric Blake <ebb9@byu.net>
parents: 9590
diff changeset
562 #if @GNULIB_STRSTR@
99268e709d31 Avoid quadratic strstr implementations.
Eric Blake <ebb9@byu.net>
parents: 9590
diff changeset
563 # if @REPLACE_STRSTR@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
564 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
565 # define strstr rpl_strstr
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
566 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
567 _GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle)
13443
6c32722a9d4b string: Fix syntax error with g++ 2.96.
Bruno Haible <bruno@clisp.org>
parents: 13194
diff changeset
568 _GL_ATTRIBUTE_PURE
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
569 _GL_ARG_NONNULL ((1, 2)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
570 _GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
571 # else
12980
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
572 /* On some systems, this function is defined as an overloaded function:
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
573 extern "C++" { const char * strstr (const char *, const char *); }
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
574 extern "C++" { char * strstr (char *, const char *); } */
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
575 _GL_CXXALIAS_SYS_CAST2 (strstr,
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
576 char *, (const char *haystack, const char *needle),
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
577 const char *, (const char *haystack, const char *needle));
9600
99268e709d31 Avoid quadratic strstr implementations.
Eric Blake <ebb9@byu.net>
parents: 9590
diff changeset
578 # endif
13885
87a95303747f Port to uClibc.
Bruno Haible <bruno@clisp.org>
parents: 13847
diff changeset
579 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
12984
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
580 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
581 _GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle));
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
582 _GL_CXXALIASWARN1 (strstr, const char *,
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
583 (const char *haystack, const char *needle));
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
584 # else
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
585 _GL_CXXALIASWARN (strstr);
12984
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
586 # endif
9600
99268e709d31 Avoid quadratic strstr implementations.
Eric Blake <ebb9@byu.net>
parents: 9590
diff changeset
587 #elif defined GNULIB_POSIXCHECK
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
588 /* strstr() does not work with multibyte strings if the locale encoding is
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
589 different from UTF-8:
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
590 POSIX says that it operates on "strings", and "string" in POSIX is defined
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
591 as a sequence of bytes, not of characters. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
592 # undef strstr
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
593 /* Assume strstr is always declared. */
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
594 _GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
595 "work correctly on character strings in most "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
596 "multibyte locales - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
597 "use mbsstr if you care about internationalization, "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
598 "or use strstr if you care about speed");
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
599 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
600
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
601 /* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
602 comparison. */
9623
69d9307c0aa0 Convert strcasestr module to use Two-Way algorithm.
Eric Blake <ebb9@byu.net>
parents: 9622
diff changeset
603 #if @GNULIB_STRCASESTR@
69d9307c0aa0 Convert strcasestr module to use Two-Way algorithm.
Eric Blake <ebb9@byu.net>
parents: 9622
diff changeset
604 # if @REPLACE_STRCASESTR@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
605 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
606 # define strcasestr rpl_strcasestr
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
607 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
608 _GL_FUNCDECL_RPL (strcasestr, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
609 (const char *haystack, const char *needle)
13443
6c32722a9d4b string: Fix syntax error with g++ 2.96.
Bruno Haible <bruno@clisp.org>
parents: 13194
diff changeset
610 _GL_ATTRIBUTE_PURE
6c32722a9d4b string: Fix syntax error with g++ 2.96.
Bruno Haible <bruno@clisp.org>
parents: 13194
diff changeset
611 _GL_ARG_NONNULL ((1, 2)));
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
612 _GL_CXXALIAS_RPL (strcasestr, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
613 (const char *haystack, const char *needle));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
614 # else
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
615 # if ! @HAVE_STRCASESTR@
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
616 _GL_FUNCDECL_SYS (strcasestr, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
617 (const char *haystack, const char *needle)
13443
6c32722a9d4b string: Fix syntax error with g++ 2.96.
Bruno Haible <bruno@clisp.org>
parents: 13194
diff changeset
618 _GL_ATTRIBUTE_PURE
6c32722a9d4b string: Fix syntax error with g++ 2.96.
Bruno Haible <bruno@clisp.org>
parents: 13194
diff changeset
619 _GL_ARG_NONNULL ((1, 2)));
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
620 # endif
12980
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
621 /* On some systems, this function is defined as an overloaded function:
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
622 extern "C++" { const char * strcasestr (const char *, const char *); }
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
623 extern "C++" { char * strcasestr (char *, const char *); } */
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
624 _GL_CXXALIAS_SYS_CAST2 (strcasestr,
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
625 char *, (const char *haystack, const char *needle),
a9cefa7a8404 Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
Bruno Haible <bruno@clisp.org>
parents: 12942
diff changeset
626 const char *, (const char *haystack, const char *needle));
9623
69d9307c0aa0 Convert strcasestr module to use Two-Way algorithm.
Eric Blake <ebb9@byu.net>
parents: 9622
diff changeset
627 # endif
13885
87a95303747f Port to uClibc.
Bruno Haible <bruno@clisp.org>
parents: 13847
diff changeset
628 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
12984
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
629 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
630 _GL_CXXALIASWARN1 (strcasestr, char *, (char *haystack, const char *needle));
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
631 _GL_CXXALIASWARN1 (strcasestr, const char *,
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
632 (const char *haystack, const char *needle));
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
633 # else
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
634 _GL_CXXALIASWARN (strcasestr);
12984
e9d0fdd4293b Fix compilation error with glibc >= 2.10 and g++ >= 4.4.
Bruno Haible <bruno@clisp.org>
parents: 12980
diff changeset
635 # endif
9623
69d9307c0aa0 Convert strcasestr module to use Two-Way algorithm.
Eric Blake <ebb9@byu.net>
parents: 9622
diff changeset
636 #elif defined GNULIB_POSIXCHECK
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
637 /* strcasestr() does not work with multibyte strings:
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
638 It is a glibc extension, and glibc implements it only for unibyte
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
639 locales. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
640 # undef strcasestr
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
641 # if HAVE_RAW_DECL_STRCASESTR
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
642 _GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
643 "strings in multibyte locales - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
644 "use mbscasestr if you care about "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
645 "internationalization, or use c-strcasestr if you want "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
646 "a locale independent function");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
647 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
648 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
649
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
650 /* Parse S into tokens separated by characters in DELIM.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
651 If S is NULL, the saved pointer in SAVE_PTR is used as
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
652 the next starting point. For example:
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11983
diff changeset
653 char s[] = "-abc-=-def";
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11983
diff changeset
654 char *sp;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11983
diff changeset
655 x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def"
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11983
diff changeset
656 x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11983
diff changeset
657 x = strtok_r(NULL, "=", &sp); // x = NULL
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11983
diff changeset
658 // s = "abc\0-def\0"
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
659
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
660 This is a variant of strtok() that is multithread-safe.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
661
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
662 For the POSIX documentation for this function, see:
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
663 http://www.opengroup.org/susv3xsh/strtok.html
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
664
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
665 Caveat: It modifies the original string.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
666 Caveat: These functions cannot be used on constant strings.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
667 Caveat: The identity of the delimiting character is lost.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
668 Caveat: It doesn't work with multibyte strings unless all of the delimiter
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
669 characters are ASCII characters < 0x30.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
670
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
671 See also strsep(). */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
672 #if @GNULIB_STRTOK_R@
11960
bc6846876d71 Work around a glibc bug in strtok_r.
Ben Pfaff <blp@gnu.org>
parents: 11832
diff changeset
673 # if @REPLACE_STRTOK_R@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
674 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
675 # undef strtok_r
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
676 # define strtok_r rpl_strtok_r
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
677 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
678 _GL_FUNCDECL_RPL (strtok_r, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
679 (char *restrict s, char const *restrict delim,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
680 char **restrict save_ptr)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
681 _GL_ARG_NONNULL ((2, 3)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
682 _GL_CXXALIAS_RPL (strtok_r, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
683 (char *restrict s, char const *restrict delim,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
684 char **restrict save_ptr));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
685 # else
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
686 # if @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
687 # undef strtok_r
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
688 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
689 # if ! @HAVE_DECL_STRTOK_R@
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
690 _GL_FUNCDECL_SYS (strtok_r, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
691 (char *restrict s, char const *restrict delim,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
692 char **restrict save_ptr)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
693 _GL_ARG_NONNULL ((2, 3)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
694 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
695 _GL_CXXALIAS_SYS (strtok_r, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
696 (char *restrict s, char const *restrict delim,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
697 char **restrict save_ptr));
11960
bc6846876d71 Work around a glibc bug in strtok_r.
Ben Pfaff <blp@gnu.org>
parents: 11832
diff changeset
698 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
699 _GL_CXXALIASWARN (strtok_r);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
700 # if defined GNULIB_POSIXCHECK
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
701 _GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
702 "strings in multibyte locales - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
703 "use mbstok_r if you care about internationalization");
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
704 # endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
705 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
706 # undef strtok_r
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
707 # if HAVE_RAW_DECL_STRTOK_R
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
708 _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
709 "use gnulib module strtok_r for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
710 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
711 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
712
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
713
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
714 /* The following functions are not specified by POSIX. They are gnulib
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
715 extensions. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
716
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
717 #if @GNULIB_MBSLEN@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
718 /* Return the number of multibyte characters in the character string STRING.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
719 This considers multibyte characters, unlike strlen, which counts bytes. */
12602
e6c17971ef92 mbslen: Avoid collision with system function.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
720 # ifdef __MirBSD__ /* MirBSD defines mbslen as a macro. Override it. */
e6c17971ef92 mbslen: Avoid collision with system function.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
721 # undef mbslen
e6c17971ef92 mbslen: Avoid collision with system function.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
722 # endif
e6c17971ef92 mbslen: Avoid collision with system function.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
723 # if @HAVE_MBSLEN@ /* AIX, OSF/1, MirBSD define mbslen already in libc. */
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
724 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
725 # define mbslen rpl_mbslen
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
726 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
727 _GL_FUNCDECL_RPL (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
728 _GL_CXXALIAS_RPL (mbslen, size_t, (const char *string));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
729 # else
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
730 _GL_FUNCDECL_SYS (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
731 _GL_CXXALIAS_SYS (mbslen, size_t, (const char *string));
12602
e6c17971ef92 mbslen: Avoid collision with system function.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
732 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
733 _GL_CXXALIASWARN (mbslen);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
734 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
735
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
736 #if @GNULIB_MBSNLEN@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
737 /* Return the number of multibyte characters in the character string starting
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
738 at STRING and ending at STRING + LEN. */
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
739 _GL_EXTERN_C size_t mbsnlen (const char *string, size_t len)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
740 _GL_ARG_NONNULL ((1));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
741 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
742
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
743 #if @GNULIB_MBSCHR@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
744 /* Locate the first single-byte character C in the character string STRING,
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
745 and return a pointer to it. Return NULL if C is not found in STRING.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
746 Unlike strchr(), this function works correctly in multibyte locales with
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
747 encodings such as GB18030. */
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
748 # if defined __hpux
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
749 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
750 # define mbschr rpl_mbschr /* avoid collision with HP-UX function */
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
751 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
752 _GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
753 _GL_ARG_NONNULL ((1)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
754 _GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
755 # else
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
756 _GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
757 _GL_ARG_NONNULL ((1)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
758 _GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
759 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
760 _GL_CXXALIASWARN (mbschr);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
761 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
762
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
763 #if @GNULIB_MBSRCHR@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
764 /* Locate the last single-byte character C in the character string STRING,
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
765 and return a pointer to it. Return NULL if C is not found in STRING.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
766 Unlike strrchr(), this function works correctly in multibyte locales with
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
767 encodings such as GB18030. */
14828
90514fe74451 mbsrchr: Avoid collision with system function on Interix.
Bruno Haible <bruno@clisp.org>
parents: 14586
diff changeset
768 # if defined __hpux || defined __INTERIX
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
769 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
14828
90514fe74451 mbsrchr: Avoid collision with system function on Interix.
Bruno Haible <bruno@clisp.org>
parents: 14586
diff changeset
770 # define mbsrchr rpl_mbsrchr /* avoid collision with system function */
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
771 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
772 _GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
773 _GL_ARG_NONNULL ((1)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
774 _GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
775 # else
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
776 _GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
777 _GL_ARG_NONNULL ((1)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
778 _GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
779 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
780 _GL_CXXALIASWARN (mbsrchr);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
781 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
782
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
783 #if @GNULIB_MBSSTR@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
784 /* Find the first occurrence of the character string NEEDLE in the character
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
785 string HAYSTACK. Return NULL if NEEDLE is not found in HAYSTACK.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
786 Unlike strstr(), this function works correctly in multibyte locales with
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
787 encodings different from UTF-8. */
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
788 _GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle)
12422
f7842310a565 New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
789 _GL_ARG_NONNULL ((1, 2));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
790 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
791
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
792 #if @GNULIB_MBSCASECMP@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
793 /* Compare the character strings S1 and S2, ignoring case, returning less than,
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
794 equal to or greater than zero if S1 is lexicographically less than, equal to
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
795 or greater than S2.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
796 Note: This function may, in multibyte locales, return 0 for strings of
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
797 different lengths!
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
798 Unlike strcasecmp(), this function works correctly in multibyte locales. */
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
799 _GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2)
12422
f7842310a565 New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
800 _GL_ARG_NONNULL ((1, 2));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
801 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
802
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
803 #if @GNULIB_MBSNCASECMP@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
804 /* Compare the initial segment of the character string S1 consisting of at most
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
805 N characters with the initial segment of the character string S2 consisting
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
806 of at most N characters, ignoring case, returning less than, equal to or
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
807 greater than zero if the initial segment of S1 is lexicographically less
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
808 than, equal to or greater than the initial segment of S2.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
809 Note: This function may, in multibyte locales, return 0 for initial segments
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
810 of different lengths!
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
811 Unlike strncasecmp(), this function works correctly in multibyte locales.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
812 But beware that N is not a byte count but a character count! */
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
813 _GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n)
12422
f7842310a565 New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
814 _GL_ARG_NONNULL ((1, 2));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
815 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
816
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
817 #if @GNULIB_MBSPCASECMP@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
818 /* Compare the initial segment of the character string STRING consisting of
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
819 at most mbslen (PREFIX) characters with the character string PREFIX,
13478
957a79f455ba mbspcasecmp: Fix function specification.
Bruno Haible <bruno@clisp.org>
parents: 13443
diff changeset
820 ignoring case. If the two match, return a pointer to the first byte
957a79f455ba mbspcasecmp: Fix function specification.
Bruno Haible <bruno@clisp.org>
parents: 13443
diff changeset
821 after this prefix in STRING. Otherwise, return NULL.
957a79f455ba mbspcasecmp: Fix function specification.
Bruno Haible <bruno@clisp.org>
parents: 13443
diff changeset
822 Note: This function may, in multibyte locales, return non-NULL if STRING
957a79f455ba mbspcasecmp: Fix function specification.
Bruno Haible <bruno@clisp.org>
parents: 13443
diff changeset
823 is of smaller length than PREFIX!
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
824 Unlike strncasecmp(), this function works correctly in multibyte
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
825 locales. */
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
826 _GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
12422
f7842310a565 New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
827 _GL_ARG_NONNULL ((1, 2));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
828 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
829
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
830 #if @GNULIB_MBSCASESTR@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
831 /* Find the first occurrence of the character string NEEDLE in the character
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
832 string HAYSTACK, using case-insensitive comparison.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
833 Note: This function may, in multibyte locales, return success even if
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
834 strlen (haystack) < strlen (needle) !
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
835 Unlike strcasestr(), this function works correctly in multibyte locales. */
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
836 _GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle)
12422
f7842310a565 New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
837 _GL_ARG_NONNULL ((1, 2));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
838 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
839
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
840 #if @GNULIB_MBSCSPN@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
841 /* Find the first occurrence in the character string STRING of any character
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
842 in the character string ACCEPT. Return the number of bytes from the
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
843 beginning of the string to this occurrence, or to the end of the string
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
844 if none exists.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
845 Unlike strcspn(), this function works correctly in multibyte locales. */
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
846 _GL_EXTERN_C size_t mbscspn (const char *string, const char *accept)
12422
f7842310a565 New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
847 _GL_ARG_NONNULL ((1, 2));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
848 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
849
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
850 #if @GNULIB_MBSPBRK@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
851 /* Find the first occurrence in the character string STRING of any character
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
852 in the character string ACCEPT. Return the pointer to it, or NULL if none
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
853 exists.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
854 Unlike strpbrk(), this function works correctly in multibyte locales. */
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
855 # if defined __hpux
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
856 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
857 # define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
858 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
859 _GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
860 _GL_ARG_NONNULL ((1, 2)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
861 _GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
862 # else
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
863 _GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
864 _GL_ARG_NONNULL ((1, 2)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
865 _GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
866 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
867 _GL_CXXALIASWARN (mbspbrk);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
868 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
869
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
870 #if @GNULIB_MBSSPN@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
871 /* Find the first occurrence in the character string STRING of any character
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
872 not in the character string REJECT. Return the number of bytes from the
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
873 beginning of the string to this occurrence, or to the end of the string
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
874 if none exists.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
875 Unlike strspn(), this function works correctly in multibyte locales. */
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
876 _GL_EXTERN_C size_t mbsspn (const char *string, const char *reject)
12422
f7842310a565 New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
877 _GL_ARG_NONNULL ((1, 2));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
878 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
879
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
880 #if @GNULIB_MBSSEP@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
881 /* Search the next delimiter (multibyte character listed in the character
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
882 string DELIM) starting at the character string *STRINGP.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
883 If one is found, overwrite it with a NUL, and advance *STRINGP to point
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
884 to the next multibyte character after it. Otherwise, set *STRINGP to NULL.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
885 If *STRINGP was already NULL, nothing happens.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
886 Return the old value of *STRINGP.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
887
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
888 This is a variant of mbstok_r() that supports empty fields.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
889
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
890 Caveat: It modifies the original string.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
891 Caveat: These functions cannot be used on constant strings.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
892 Caveat: The identity of the delimiting character is lost.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
893
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
894 See also mbstok_r(). */
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
895 _GL_EXTERN_C char * mbssep (char **stringp, const char *delim)
12422
f7842310a565 New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
896 _GL_ARG_NONNULL ((1, 2));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
897 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
898
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
899 #if @GNULIB_MBSTOK_R@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
900 /* Parse the character string STRING into tokens separated by characters in
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
901 the character string DELIM.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
902 If STRING is NULL, the saved pointer in SAVE_PTR is used as
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
903 the next starting point. For example:
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11983
diff changeset
904 char s[] = "-abc-=-def";
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11983
diff changeset
905 char *sp;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11983
diff changeset
906 x = mbstok_r(s, "-", &sp); // x = "abc", sp = "=-def"
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11983
diff changeset
907 x = mbstok_r(NULL, "-=", &sp); // x = "def", sp = NULL
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11983
diff changeset
908 x = mbstok_r(NULL, "=", &sp); // x = NULL
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11983
diff changeset
909 // s = "abc\0-def\0"
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
910
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
911 Caveat: It modifies the original string.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
912 Caveat: These functions cannot be used on constant strings.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
913 Caveat: The identity of the delimiting character is lost.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
914
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
915 See also mbssep(). */
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
916 _GL_EXTERN_C char * mbstok_r (char *string, const char *delim, char **save_ptr)
12422
f7842310a565 New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
917 _GL_ARG_NONNULL ((2, 3));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
918 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
919
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
920 /* Map any int, typically from errno, into an error message. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
921 #if @GNULIB_STRERROR@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
922 # if @REPLACE_STRERROR@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
923 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
924 # undef strerror
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
925 # define strerror rpl_strerror
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
926 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
927 _GL_FUNCDECL_RPL (strerror, char *, (int));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
928 _GL_CXXALIAS_RPL (strerror, char *, (int));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
929 # else
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
930 _GL_CXXALIAS_SYS (strerror, char *, (int));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
931 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
932 _GL_CXXALIASWARN (strerror);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
933 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
934 # undef strerror
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
935 /* Assume strerror is always declared. */
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
936 _GL_WARN_ON_USE (strerror, "strerror is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
937 "use gnulib module strerror to guarantee non-NULL result");
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
938 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
939
13847
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
940 /* Map any int, typically from errno, into an error message. Multithread-safe.
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
941 Uses the POSIX declaration, not the glibc declaration. */
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
942 #if @GNULIB_STRERROR_R@
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
943 # if @REPLACE_STRERROR_R@
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
944 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
945 # undef strerror_r
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
946 # define strerror_r rpl_strerror_r
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
947 # endif
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
948 _GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen)
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
949 _GL_ARG_NONNULL ((2)));
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
950 _GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen));
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
951 # else
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
952 # if !@HAVE_DECL_STRERROR_R@
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
953 _GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
954 _GL_ARG_NONNULL ((2)));
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
955 # endif
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
956 _GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen));
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
957 # endif
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
958 # if @HAVE_DECL_STRERROR_R@
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
959 _GL_CXXALIASWARN (strerror_r);
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
960 # endif
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
961 #elif defined GNULIB_POSIXCHECK
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
962 # undef strerror_r
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
963 # if HAVE_RAW_DECL_STRERROR_R
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
964 _GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - "
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
965 "use gnulib module strerror_r-posix for portability");
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
966 # endif
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
967 #endif
99dd2b4fab8b New module 'strerror_r-posix'.
Bruno Haible <bruno@clisp.org>
parents: 13773
diff changeset
968
9616
878f41b0e41e New module 'strsignal'.
Colin Watson <cjwatson@debian.org>
parents: 9613
diff changeset
969 #if @GNULIB_STRSIGNAL@
9622
7b32838d1079 Replace strsignal if it does not work fine.
Bruno Haible <bruno@clisp.org>
parents: 9616
diff changeset
970 # if @REPLACE_STRSIGNAL@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
971 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
972 # define strsignal rpl_strsignal
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
973 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
974 _GL_FUNCDECL_RPL (strsignal, char *, (int __sig));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
975 _GL_CXXALIAS_RPL (strsignal, char *, (int __sig));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
976 # else
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
977 # if ! @HAVE_DECL_STRSIGNAL@
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
978 _GL_FUNCDECL_SYS (strsignal, char *, (int __sig));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
979 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
980 /* Need to cast, because on Cygwin 1.5.x systems, the return type is
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
981 'const char *'. */
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
982 _GL_CXXALIAS_SYS_CAST (strsignal, char *, (int __sig));
9622
7b32838d1079 Replace strsignal if it does not work fine.
Bruno Haible <bruno@clisp.org>
parents: 9616
diff changeset
983 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
984 _GL_CXXALIASWARN (strsignal);
9616
878f41b0e41e New module 'strsignal'.
Colin Watson <cjwatson@debian.org>
parents: 9613
diff changeset
985 #elif defined GNULIB_POSIXCHECK
878f41b0e41e New module 'strsignal'.
Colin Watson <cjwatson@debian.org>
parents: 9613
diff changeset
986 # undef strsignal
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
987 # if HAVE_RAW_DECL_STRSIGNAL
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
988 _GL_WARN_ON_USE (strsignal, "strsignal is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
989 "use gnulib module strsignal for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
990 # endif
9616
878f41b0e41e New module 'strsignal'.
Colin Watson <cjwatson@debian.org>
parents: 9613
diff changeset
991 #endif
878f41b0e41e New module 'strsignal'.
Colin Watson <cjwatson@debian.org>
parents: 9613
diff changeset
992
10345
8d80c477e0ad strverscmp: migrate from "strverscmp.h" to <string.h>
Eric Blake <ebb9@byu.net>
parents: 9999
diff changeset
993 #if @GNULIB_STRVERSCMP@
8d80c477e0ad strverscmp: migrate from "strverscmp.h" to <string.h>
Eric Blake <ebb9@byu.net>
parents: 9999
diff changeset
994 # if !@HAVE_STRVERSCMP@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
995 _GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
996 _GL_ARG_NONNULL ((1, 2)));
10345
8d80c477e0ad strverscmp: migrate from "strverscmp.h" to <string.h>
Eric Blake <ebb9@byu.net>
parents: 9999
diff changeset
997 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
998 _GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
999 _GL_CXXALIASWARN (strverscmp);
10345
8d80c477e0ad strverscmp: migrate from "strverscmp.h" to <string.h>
Eric Blake <ebb9@byu.net>
parents: 9999
diff changeset
1000 #elif defined GNULIB_POSIXCHECK
8d80c477e0ad strverscmp: migrate from "strverscmp.h" to <string.h>
Eric Blake <ebb9@byu.net>
parents: 9999
diff changeset
1001 # undef strverscmp
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
1002 # if HAVE_RAW_DECL_STRVERSCMP
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
1003 _GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
1004 "use gnulib module strverscmp for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
1005 # endif
10345
8d80c477e0ad strverscmp: migrate from "strverscmp.h" to <string.h>
Eric Blake <ebb9@byu.net>
parents: 9999
diff changeset
1006 #endif
8d80c477e0ad strverscmp: migrate from "strverscmp.h" to <string.h>
Eric Blake <ebb9@byu.net>
parents: 9999
diff changeset
1007
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1008
14840
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14828
diff changeset
1009 #endif /* _@GUARD_PREFIX@_STRING_H */
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14828
diff changeset
1010 #endif /* _@GUARD_PREFIX@_STRING_H */