annotate lib/string.in.h @ 12942:17ee1f140456

string: Avoid #define replacements in C++ mode.
author Bruno Haible <bruno@clisp.org>
date Mon, 08 Mar 2010 01:26:36 +0100
parents 2c14f1e449e5
children a9cefa7a8404
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
12559
c2cbabec01dd update nearly all FSF copyright year lists to include 2010
Jim Meyering <meyering@redhat.com>
parents: 12422
diff changeset
3 Copyright (C) 1995-1996, 2001-2010 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
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16 along with this program; if not, write to the Free Software Foundation,
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 #ifndef _GL_STRING_H
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20
10655
8668b19a7032 Avoid gcc warnings because of #pragma GCC system_header on older gcc.
Bruno Haible <bruno@clisp.org>
parents: 10456
diff changeset
21 #if __GNUC__ >= 3
10375
f96e845fc36d Avoid some "gcc -pedantic" warnings.
Bruno Haible <bruno@clisp.org>
parents: 10345
diff changeset
22 @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
23 #endif
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
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 #ifndef _GL_STRING_H
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 #define _GL_STRING_H
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
9590
246fc6fd3787 Give gcc some memmem optimization hints.
Eric Blake <ebb9@byu.net>
parents: 9538
diff changeset
39 #ifndef __attribute__
246fc6fd3787 Give gcc some memmem optimization hints.
Eric Blake <ebb9@byu.net>
parents: 9538
diff changeset
40 /* This feature is available in gcc versions 2.5 and later. */
9613
c4fa39bf5223 Don't redefine __attribute__ without a need.
Bruno Haible <bruno@clisp.org>
parents: 9600
diff changeset
41 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
9590
246fc6fd3787 Give gcc some memmem optimization hints.
Eric Blake <ebb9@byu.net>
parents: 9538
diff changeset
42 # define __attribute__(Spec) /* empty */
246fc6fd3787 Give gcc some memmem optimization hints.
Eric Blake <ebb9@byu.net>
parents: 9538
diff changeset
43 # endif
246fc6fd3787 Give gcc some memmem optimization hints.
Eric Blake <ebb9@byu.net>
parents: 9538
diff changeset
44 /* The attribute __pure__ was added in gcc 2.96. */
246fc6fd3787 Give gcc some memmem optimization hints.
Eric Blake <ebb9@byu.net>
parents: 9538
diff changeset
45 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
246fc6fd3787 Give gcc some memmem optimization hints.
Eric Blake <ebb9@byu.net>
parents: 9538
diff changeset
46 # define __pure__ /* empty */
246fc6fd3787 Give gcc some memmem optimization hints.
Eric Blake <ebb9@byu.net>
parents: 9538
diff changeset
47 # endif
246fc6fd3787 Give gcc some memmem optimization hints.
Eric Blake <ebb9@byu.net>
parents: 9538
diff changeset
48 #endif
246fc6fd3787 Give gcc some memmem optimization hints.
Eric Blake <ebb9@byu.net>
parents: 9538
diff changeset
49
246fc6fd3787 Give gcc some memmem optimization hints.
Eric Blake <ebb9@byu.net>
parents: 9538
diff changeset
50
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
51 /* 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
52
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
53 /* 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
54
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
55 /* 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
56
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
57
11621
c98fca1ff8b8 memchr: detect broken x86_64 and alpha implementations
Eric Blake <ebb9@byu.net>
parents: 10655
diff changeset
58 /* 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
59 #if @GNULIB_MEMCHR@
c98fca1ff8b8 memchr: detect broken x86_64 and alpha implementations
Eric Blake <ebb9@byu.net>
parents: 10655
diff changeset
60 # if @REPLACE_MEMCHR@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
61 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
62 # define memchr rpl_memchr
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
63 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
64 _GL_FUNCDECL_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
65 __attribute__ ((__pure__))
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
66 _GL_ARG_NONNULL ((1)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
67 _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
68 # else
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
69 # if defined __SUNPRO_CC
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
70 /* This compiler defines an overloaded function
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
71 extern "C" { const void * std::memchr (const void *, int, size_t); }
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
72 extern "C++" { inline void * std::memchr (void *, int, size_t); }
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
73 and diagnoses an error
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
74 "Error: Could not find a match for std::memchr(const void*, int, unsigned)"
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
75 */
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
76 _GL_CXXALIAS_SYS_CAST2 (memchr,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
77 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
78 void const *, (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
79 # else
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
80 _GL_CXXALIAS_SYS (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
81 # endif
11621
c98fca1ff8b8 memchr: detect broken x86_64 and alpha implementations
Eric Blake <ebb9@byu.net>
parents: 10655
diff changeset
82 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
83 _GL_CXXALIASWARN (memchr);
11621
c98fca1ff8b8 memchr: detect broken x86_64 and alpha implementations
Eric Blake <ebb9@byu.net>
parents: 10655
diff changeset
84 #elif defined GNULIB_POSIXCHECK
c98fca1ff8b8 memchr: detect broken x86_64 and alpha implementations
Eric Blake <ebb9@byu.net>
parents: 10655
diff changeset
85 # undef memchr
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
86 /* Assume memchr is always declared. */
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
87 _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
88 "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
89 #endif
c98fca1ff8b8 memchr: detect broken x86_64 and alpha implementations
Eric Blake <ebb9@byu.net>
parents: 10655
diff changeset
90
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
91 /* Return the first occurrence of NEEDLE in HAYSTACK. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
92 #if @GNULIB_MEMMEM@
9538
43d9769bf4d0 Fix memmem to avoid O(n^2) worst-case complexity.
Eric Blake <ebb9@byu.net>
parents: 9496
diff changeset
93 # if @REPLACE_MEMMEM@
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 memmem rpl_memmem
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 (memmem, void *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
98 (void const *__haystack, size_t __haystack_len,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
99 void const *__needle, size_t __needle_len)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
100 __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 3)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
101 _GL_CXXALIAS_RPL (memmem, void *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
102 (void const *__haystack, size_t __haystack_len,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
103 void const *__needle, size_t __needle_len));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
104 # else
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
105 # if ! @HAVE_DECL_MEMMEM@
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
106 _GL_FUNCDECL_SYS (memmem, void *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
107 (void const *__haystack, size_t __haystack_len,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
108 void const *__needle, size_t __needle_len)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
109 __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 3)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
110 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
111 _GL_CXXALIAS_SYS (memmem, void *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
112 (void const *__haystack, size_t __haystack_len,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
113 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
114 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
115 _GL_CXXALIASWARN (memmem);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
116 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
117 # undef memmem
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
118 # if HAVE_RAW_DECL_MEMMEM
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
119 _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
120 "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
121 "and module memmem for speed" );
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
122 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
123 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
124
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
125 /* 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
126 last written byte. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
127 #if @GNULIB_MEMPCPY@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
128 # if ! @HAVE_MEMPCPY@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
129 _GL_FUNCDECL_SYS (mempcpy, void *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
130 (void *restrict __dest, void const *restrict __src,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
131 size_t __n)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
132 _GL_ARG_NONNULL ((1, 2)));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
133 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
134 _GL_CXXALIAS_SYS (mempcpy, void *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
135 (void *restrict __dest, void const *restrict __src,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
136 size_t __n));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
137 _GL_CXXALIASWARN (mempcpy);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
138 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
139 # undef mempcpy
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
140 # if HAVE_RAW_DECL_MEMPCPY
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
141 _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
142 "use gnulib module mempcpy for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
143 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
144 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
145
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
146 /* 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
147 #if @GNULIB_MEMRCHR@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
148 # if ! @HAVE_DECL_MEMRCHR@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
149 _GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
150 __attribute__ ((__pure__))
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
151 _GL_ARG_NONNULL ((1)));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
152 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
153 _GL_CXXALIAS_SYS (memrchr, void *, (void const *, int, size_t));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
154 _GL_CXXALIASWARN (memrchr);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
155 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
156 # undef memrchr
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
157 # if HAVE_RAW_DECL_MEMRCHR
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
158 _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
159 "use gnulib module memrchr for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
160 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
161 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
162
9999
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
163 /* 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
164 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
165 occur within N bytes. */
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
166 #if @GNULIB_RAWMEMCHR@
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
167 # if ! @HAVE_RAWMEMCHR@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
168 _GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
169 __attribute__ ((__pure__))
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
170 _GL_ARG_NONNULL ((1)));
9999
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
171 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
172 _GL_CXXALIAS_SYS (rawmemchr, void *, (void const *__s, int __c_in));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
173 _GL_CXXALIASWARN (rawmemchr);
9999
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
174 #elif defined GNULIB_POSIXCHECK
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
175 # undef rawmemchr
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
176 # if HAVE_RAW_DECL_RAWMEMCHR
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
177 _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
178 "use gnulib module rawmemchr for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
179 # endif
9999
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
180 #endif
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
181
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
182 /* 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
183 #if @GNULIB_STPCPY@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
184 # if ! @HAVE_STPCPY@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
185 _GL_FUNCDECL_SYS (stpcpy, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
186 (char *restrict __dst, char const *restrict __src)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
187 _GL_ARG_NONNULL ((1, 2)));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
188 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
189 _GL_CXXALIAS_SYS (stpcpy, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
190 (char *restrict __dst, char const *restrict __src));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
191 _GL_CXXALIASWARN (stpcpy);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
192 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
193 # undef stpcpy
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
194 # if HAVE_RAW_DECL_STPCPY
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
195 _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
196 "use gnulib module stpcpy for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
197 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
198 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
199
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
200 /* 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
201 last non-NUL byte written into DST. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
202 #if @GNULIB_STPNCPY@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
203 # if ! @HAVE_STPNCPY@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
204 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
205 # define stpncpy rpl_stpncpy
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
206 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
207 _GL_FUNCDECL_RPL (stpncpy, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
208 (char *restrict __dst, char const *restrict __src,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
209 size_t __n)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
210 _GL_ARG_NONNULL ((1, 2)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
211 _GL_CXXALIAS_RPL (stpncpy, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
212 (char *restrict __dst, char const *restrict __src,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
213 size_t __n));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
214 # else
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
215 _GL_CXXALIAS_SYS (stpncpy, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
216 (char *restrict __dst, char const *restrict __src,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
217 size_t __n));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
218 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
219 _GL_CXXALIASWARN (stpncpy);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
220 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
221 # undef stpncpy
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
222 # if HAVE_RAW_DECL_STPNCPY
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
223 _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
224 "use gnulib module stpncpy for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
225 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
226 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
227
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
228 #if defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
229 /* 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
230 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
231 # undef strchr
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
232 /* Assume strchr is always declared. */
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
233 _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
234 "in some multibyte locales - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
235 "use mbschr if you care about internationalization");
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
236 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
237
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
238 /* 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
239 #if @GNULIB_STRCHRNUL@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
240 # if ! @HAVE_STRCHRNUL@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
241 _GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
242 __attribute__ ((__pure__))
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
243 _GL_ARG_NONNULL ((1)));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
244 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
245 _GL_CXXALIAS_SYS (strchrnul, char *, (char const *__s, int __c_in));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
246 _GL_CXXALIASWARN (strchrnul);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
247 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
248 # undef strchrnul
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
249 # if HAVE_RAW_DECL_STRCHRNUL
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
250 _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
251 "use gnulib module strchrnul for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
252 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
253 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
254
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
255 /* Duplicate S, returning an identical malloc'd string. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
256 #if @GNULIB_STRDUP@
10456
a821fdd7b2b7 New module 'strdup-posix'.
Bruno Haible <bruno@clisp.org>
parents: 10375
diff changeset
257 # if @REPLACE_STRDUP@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
258 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
259 # undef strdup
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
260 # define strdup rpl_strdup
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
261 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
262 _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
263 _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
264 # else
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
265 # if !(@HAVE_DECL_STRDUP@ || defined strdup)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
266 _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
267 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
268 _GL_CXXALIAS_SYS (strdup, char *, (char const *__s));
10456
a821fdd7b2b7 New module 'strdup-posix'.
Bruno Haible <bruno@clisp.org>
parents: 10375
diff changeset
269 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
270 _GL_CXXALIASWARN (strdup);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
271 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
272 # undef strdup
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
273 # if HAVE_RAW_DECL_STRDUP
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
274 _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
275 "use gnulib module strdup for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
276 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
277 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
278
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
279 /* 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
280 #if @GNULIB_STRNDUP@
11983
5f256f637c47 strndup: fix improper m4 caching
Eric Blake <ebb9@byu.net>
parents: 11960
diff changeset
281 # if @REPLACE_STRNDUP@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
282 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
283 # undef strndup
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
284 # define strndup rpl_strndup
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
285 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
286 _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
287 _GL_ARG_NONNULL ((1)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
288 _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
289 # else
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
290 # if ! @HAVE_DECL_STRNDUP@
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
291 _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
292 _GL_ARG_NONNULL ((1)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
293 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
294 _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
295 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
296 _GL_CXXALIASWARN (strndup);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
297 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
298 # undef strndup
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
299 # if HAVE_RAW_DECL_STRNDUP
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
300 _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
301 "use gnulib module strndup for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
302 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
303 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
304
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
305 /* 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
306 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
307 return MAXLEN. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
308 #if @GNULIB_STRNLEN@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
309 # if ! @HAVE_DECL_STRNLEN@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
310 _GL_FUNCDECL_SYS (strnlen, size_t, (char const *__string, size_t __maxlen)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
311 __attribute__ ((__pure__))
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
312 _GL_ARG_NONNULL ((1)));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
313 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
314 _GL_CXXALIAS_SYS (strnlen, size_t, (char const *__string, size_t __maxlen));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
315 _GL_CXXALIASWARN (strnlen);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
316 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
317 # undef strnlen
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
318 # if HAVE_RAW_DECL_STRNLEN
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
319 _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
320 "use gnulib module strnlen for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
321 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
322 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
323
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
324 #if defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
325 /* 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
326 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
327 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
328 digit. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
329 # undef strcspn
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
330 /* Assume strcspn is always declared. */
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
331 _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
332 "in multibyte locales - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
333 "use mbscspn if you care about internationalization");
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
334 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
335
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
336 /* 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
337 #if @GNULIB_STRPBRK@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
338 # if ! @HAVE_STRPBRK@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
339 _GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
340 __attribute__ ((__pure__))
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
341 _GL_ARG_NONNULL ((1, 2)));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
342 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
343 # if defined __SUNPRO_CC
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
344 /* This compiler defines an overloaded function
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
345 extern "C" { const char * strpbrk (const char *, const char *); }
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
346 extern "C++" { inline char * strpbrk (char *, const char *); }
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
347 and diagnoses an error
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
348 "Error: Could not find a match for std::strpbrk(const char*, const char*)"
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
349 */
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
350 _GL_CXXALIAS_SYS_CAST2 (strpbrk,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
351 char *, (char const *__s, char const *__accept),
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
352 const char *, (char const *__s, char const *__accept));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
353 # else
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
354 _GL_CXXALIAS_SYS (strpbrk, char *, (char const *__s, char const *__accept));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
355 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
356 _GL_CXXALIASWARN (strpbrk);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
357 # if defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
358 /* 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
359 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
360 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
361 digit. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
362 # undef strpbrk
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
363 _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
364 "in multibyte locales - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
365 "use mbspbrk if you care about internationalization");
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
366 # endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
367 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
368 # undef strpbrk
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
369 # if HAVE_RAW_DECL_STRPBRK
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
370 _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
371 "use gnulib module strpbrk for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
372 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
373 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
374
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
375 #if defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
376 /* 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
377 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
378 # undef strspn
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
379 /* Assume strspn is always declared. */
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
380 _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
381 "in multibyte locales - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
382 "use mbsspn if you care about internationalization");
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
383 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
384
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
385 #if defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
386 /* 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
387 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
388 # undef strrchr
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
389 /* Assume strrchr is always declared. */
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
390 _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
391 "in some multibyte locales - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
392 "use mbsrchr if you care about internationalization");
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
393 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
394
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
395 /* 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
396 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
397 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
398 If *STRINGP was already NULL, nothing happens.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
399 Return the old value of *STRINGP.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
400
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
401 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
402 empty fields.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
403
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
404 Caveat: It modifies the original string.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
405 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
406 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
407 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
408 characters are ASCII characters < 0x30.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
409
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
410 See also strtok_r(). */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
411 #if @GNULIB_STRSEP@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
412 # if ! @HAVE_STRSEP@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
413 _GL_FUNCDECL_SYS (strsep, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
414 (char **restrict __stringp, char const *restrict __delim)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
415 _GL_ARG_NONNULL ((1, 2)));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
416 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
417 _GL_CXXALIAS_SYS (strsep, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
418 (char **restrict __stringp, char const *restrict __delim));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
419 _GL_CXXALIASWARN (strsep);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
420 # if defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
421 # undef strsep
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
422 _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
423 "in multibyte locales - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
424 "use mbssep if you care about internationalization");
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
425 # endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
426 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
427 # undef strsep
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
428 # if HAVE_RAW_DECL_STRSEP
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
429 _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
430 "use gnulib module strsep for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
431 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
432 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
433
9600
99268e709d31 Avoid quadratic strstr implementations.
Eric Blake <ebb9@byu.net>
parents: 9590
diff changeset
434 #if @GNULIB_STRSTR@
99268e709d31 Avoid quadratic strstr implementations.
Eric Blake <ebb9@byu.net>
parents: 9590
diff changeset
435 # if @REPLACE_STRSTR@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
436 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
437 # define strstr rpl_strstr
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
438 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
439 _GL_FUNCDECL_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
440 __attribute__ ((__pure__))
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
441 _GL_ARG_NONNULL ((1, 2)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
442 _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
443 # else
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
444 _GL_CXXALIAS_SYS (strstr, char *, (const char *haystack, const char *needle));
9600
99268e709d31 Avoid quadratic strstr implementations.
Eric Blake <ebb9@byu.net>
parents: 9590
diff changeset
445 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
446 _GL_CXXALIASWARN (strstr);
9600
99268e709d31 Avoid quadratic strstr implementations.
Eric Blake <ebb9@byu.net>
parents: 9590
diff changeset
447 #elif defined GNULIB_POSIXCHECK
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
448 /* 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
449 different from UTF-8:
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
450 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
451 as a sequence of bytes, not of characters. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
452 # undef strstr
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
453 /* Assume strstr is always declared. */
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
454 _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
455 "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
456 "multibyte locales - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
457 "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
458 "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
459 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
460
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
461 /* 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
462 comparison. */
9623
69d9307c0aa0 Convert strcasestr module to use Two-Way algorithm.
Eric Blake <ebb9@byu.net>
parents: 9622
diff changeset
463 #if @GNULIB_STRCASESTR@
69d9307c0aa0 Convert strcasestr module to use Two-Way algorithm.
Eric Blake <ebb9@byu.net>
parents: 9622
diff changeset
464 # if @REPLACE_STRCASESTR@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
465 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
466 # define strcasestr rpl_strcasestr
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
467 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
468 _GL_FUNCDECL_RPL (strcasestr, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
469 (const char *haystack, const char *needle)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
470 __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
471 _GL_CXXALIAS_RPL (strcasestr, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
472 (const char *haystack, const char *needle));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
473 # else
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
474 # if ! @HAVE_STRCASESTR@
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
475 _GL_FUNCDECL_SYS (strcasestr, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
476 (const char *haystack, const char *needle)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
477 __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
478 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
479 _GL_CXXALIAS_SYS (strcasestr, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
480 (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
481 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
482 _GL_CXXALIASWARN (strcasestr);
9623
69d9307c0aa0 Convert strcasestr module to use Two-Way algorithm.
Eric Blake <ebb9@byu.net>
parents: 9622
diff changeset
483 #elif defined GNULIB_POSIXCHECK
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
484 /* strcasestr() does not work with multibyte strings:
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
485 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
486 locales. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
487 # undef strcasestr
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
488 # if HAVE_RAW_DECL_STRCASESTR
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
489 _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
490 "strings in multibyte locales - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
491 "use mbscasestr if you care about "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
492 "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
493 "a locale independent function");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
494 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
495 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
496
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
497 /* 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
498 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
499 the next starting point. For example:
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11983
diff changeset
500 char s[] = "-abc-=-def";
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11983
diff changeset
501 char *sp;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11983
diff changeset
502 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
503 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
504 x = strtok_r(NULL, "=", &sp); // x = NULL
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11983
diff changeset
505 // s = "abc\0-def\0"
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
506
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
507 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
508
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
509 For the POSIX documentation for this function, see:
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
510 http://www.opengroup.org/susv3xsh/strtok.html
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
511
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
512 Caveat: It modifies the original string.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
513 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
514 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
515 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
516 characters are ASCII characters < 0x30.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
517
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
518 See also strsep(). */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
519 #if @GNULIB_STRTOK_R@
11960
bc6846876d71 Work around a glibc bug in strtok_r.
Ben Pfaff <blp@gnu.org>
parents: 11832
diff changeset
520 # if @REPLACE_STRTOK_R@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
521 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
522 # undef strtok_r
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
523 # define strtok_r rpl_strtok_r
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
524 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
525 _GL_FUNCDECL_RPL (strtok_r, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
526 (char *restrict s, char const *restrict delim,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
527 char **restrict save_ptr)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
528 _GL_ARG_NONNULL ((2, 3)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
529 _GL_CXXALIAS_RPL (strtok_r, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
530 (char *restrict s, char const *restrict delim,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
531 char **restrict save_ptr));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
532 # else
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
533 # if @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
534 # undef strtok_r
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
535 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
536 # if ! @HAVE_DECL_STRTOK_R@
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
537 _GL_FUNCDECL_SYS (strtok_r, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
538 (char *restrict s, char const *restrict delim,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
539 char **restrict save_ptr)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
540 _GL_ARG_NONNULL ((2, 3)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
541 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
542 _GL_CXXALIAS_SYS (strtok_r, char *,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
543 (char *restrict s, char const *restrict delim,
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
544 char **restrict save_ptr));
11960
bc6846876d71 Work around a glibc bug in strtok_r.
Ben Pfaff <blp@gnu.org>
parents: 11832
diff changeset
545 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
546 _GL_CXXALIASWARN (strtok_r);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
547 # if defined GNULIB_POSIXCHECK
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
548 _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
549 "strings in multibyte locales - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
550 "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
551 # endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
552 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
553 # undef strtok_r
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
554 # if HAVE_RAW_DECL_STRTOK_R
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
555 _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
556 "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
557 # endif
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
558 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
559
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
560
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
561 /* 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
562 extensions. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
563
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
564 #if @GNULIB_MBSLEN@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
565 /* 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
566 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
567 # 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
568 # undef mbslen
e6c17971ef92 mbslen: Avoid collision with system function.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
569 # endif
e6c17971ef92 mbslen: Avoid collision with system function.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
570 # 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
571 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
572 # define mbslen rpl_mbslen
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
573 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
574 _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
575 _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
576 # else
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
577 _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
578 _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
579 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
580 _GL_CXXALIASWARN (mbslen);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
581 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
582
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
583 #if @GNULIB_MBSNLEN@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
584 /* 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
585 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
586 _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
587 _GL_ARG_NONNULL ((1));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
588 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
589
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
590 #if @GNULIB_MBSCHR@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
591 /* 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
592 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
593 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
594 encodings such as GB18030. */
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
595 # if defined __hpux
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
596 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
597 # 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
598 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
599 _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
600 _GL_ARG_NONNULL ((1)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
601 _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
602 # else
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
603 _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
604 _GL_ARG_NONNULL ((1)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
605 _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
606 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
607 _GL_CXXALIASWARN (mbschr);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
608 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
609
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
610 #if @GNULIB_MBSRCHR@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
611 /* 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
612 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
613 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
614 encodings such as GB18030. */
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
615 # if defined __hpux
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
616 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
617 # define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
618 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
619 _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
620 _GL_ARG_NONNULL ((1)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
621 _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
622 # else
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
623 _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
624 _GL_ARG_NONNULL ((1)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
625 _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
626 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
627 _GL_CXXALIASWARN (mbsrchr);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
628 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
629
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
630 #if @GNULIB_MBSSTR@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
631 /* 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
632 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
633 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
634 encodings different from UTF-8. */
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
635 _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
636 _GL_ARG_NONNULL ((1, 2));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
637 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
638
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
639 #if @GNULIB_MBSCASECMP@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
640 /* 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
641 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
642 or greater than S2.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
643 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
644 different lengths!
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
645 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
646 _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
647 _GL_ARG_NONNULL ((1, 2));
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 #if @GNULIB_MBSNCASECMP@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
651 /* 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
652 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
653 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
654 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
655 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
656 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
657 of different lengths!
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
658 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
659 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
660 _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
661 _GL_ARG_NONNULL ((1, 2));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
662 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
663
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
664 #if @GNULIB_MBSPCASECMP@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
665 /* 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
666 at most mbslen (PREFIX) characters with the character string PREFIX,
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
667 ignoring case, returning less than, equal to or greater than zero if this
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
668 initial segment is lexicographically less than, equal to or greater than
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
669 PREFIX.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
670 Note: This function may, in multibyte locales, return 0 if STRING is of
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
671 smaller length than PREFIX!
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
672 Unlike strncasecmp(), this function works correctly in multibyte
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
673 locales. */
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
674 _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
675 _GL_ARG_NONNULL ((1, 2));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
676 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
677
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
678 #if @GNULIB_MBSCASESTR@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
679 /* 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
680 string HAYSTACK, using case-insensitive comparison.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
681 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
682 strlen (haystack) < strlen (needle) !
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
683 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
684 _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
685 _GL_ARG_NONNULL ((1, 2));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
686 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
687
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
688 #if @GNULIB_MBSCSPN@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
689 /* 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
690 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
691 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
692 if none exists.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
693 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
694 _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
695 _GL_ARG_NONNULL ((1, 2));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
696 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
697
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
698 #if @GNULIB_MBSPBRK@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
699 /* 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
700 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
701 exists.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
702 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
703 # if defined __hpux
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
704 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
705 # 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
706 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
707 _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
708 _GL_ARG_NONNULL ((1, 2)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
709 _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
710 # else
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
711 _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
712 _GL_ARG_NONNULL ((1, 2)));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
713 _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
714 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
715 _GL_CXXALIASWARN (mbspbrk);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
716 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
717
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
718 #if @GNULIB_MBSSPN@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
719 /* 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
720 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
721 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
722 if none exists.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
723 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
724 _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
725 _GL_ARG_NONNULL ((1, 2));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
726 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
727
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
728 #if @GNULIB_MBSSEP@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
729 /* 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
730 string DELIM) starting at the character string *STRINGP.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
731 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
732 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
733 If *STRINGP was already NULL, nothing happens.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
734 Return the old value of *STRINGP.
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 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
737
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
738 Caveat: It modifies the original string.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
739 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
740 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
741
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
742 See also mbstok_r(). */
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
743 _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
744 _GL_ARG_NONNULL ((1, 2));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
745 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
746
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
747 #if @GNULIB_MBSTOK_R@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
748 /* 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
749 the character string DELIM.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
750 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
751 the next starting point. For example:
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11983
diff changeset
752 char s[] = "-abc-=-def";
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11983
diff changeset
753 char *sp;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11983
diff changeset
754 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
755 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
756 x = mbstok_r(NULL, "=", &sp); // x = NULL
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11983
diff changeset
757 // s = "abc\0-def\0"
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
758
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
759 Caveat: It modifies the original string.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
760 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
761 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
762
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
763 See also mbssep(). */
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
764 _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
765 _GL_ARG_NONNULL ((2, 3));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
766 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
767
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
768 /* 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
769 #if @GNULIB_STRERROR@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
770 # if @REPLACE_STRERROR@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
771 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
772 # undef strerror
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
773 # define strerror rpl_strerror
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
774 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
775 _GL_FUNCDECL_RPL (strerror, char *, (int));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
776 _GL_CXXALIAS_RPL (strerror, char *, (int));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
777 # else
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
778 _GL_CXXALIAS_SYS (strerror, char *, (int));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
779 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
780 _GL_CXXALIASWARN (strerror);
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
781 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
782 # undef strerror
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
783 /* Assume strerror is always declared. */
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
784 _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
785 "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
786 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
787
9616
878f41b0e41e New module 'strsignal'.
Colin Watson <cjwatson@debian.org>
parents: 9613
diff changeset
788 #if @GNULIB_STRSIGNAL@
9622
7b32838d1079 Replace strsignal if it does not work fine.
Bruno Haible <bruno@clisp.org>
parents: 9616
diff changeset
789 # if @REPLACE_STRSIGNAL@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
790 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
791 # define strsignal rpl_strsignal
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
792 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
793 _GL_FUNCDECL_RPL (strsignal, char *, (int __sig));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
794 _GL_CXXALIAS_RPL (strsignal, char *, (int __sig));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
795 # else
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
796 # if ! @HAVE_DECL_STRSIGNAL@
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
797 _GL_FUNCDECL_SYS (strsignal, char *, (int __sig));
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
798 # endif
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
799 /* 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
800 'const char *'. */
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
801 _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
802 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
803 _GL_CXXALIASWARN (strsignal);
9616
878f41b0e41e New module 'strsignal'.
Colin Watson <cjwatson@debian.org>
parents: 9613
diff changeset
804 #elif defined GNULIB_POSIXCHECK
878f41b0e41e New module 'strsignal'.
Colin Watson <cjwatson@debian.org>
parents: 9613
diff changeset
805 # undef strsignal
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
806 # if HAVE_RAW_DECL_STRSIGNAL
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
807 _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
808 "use gnulib module strsignal for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
809 # endif
9616
878f41b0e41e New module 'strsignal'.
Colin Watson <cjwatson@debian.org>
parents: 9613
diff changeset
810 #endif
878f41b0e41e New module 'strsignal'.
Colin Watson <cjwatson@debian.org>
parents: 9613
diff changeset
811
10345
8d80c477e0ad strverscmp: migrate from "strverscmp.h" to <string.h>
Eric Blake <ebb9@byu.net>
parents: 9999
diff changeset
812 #if @GNULIB_STRVERSCMP@
8d80c477e0ad strverscmp: migrate from "strverscmp.h" to <string.h>
Eric Blake <ebb9@byu.net>
parents: 9999
diff changeset
813 # if !@HAVE_STRVERSCMP@
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
814 _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
815 _GL_ARG_NONNULL ((1, 2)));
10345
8d80c477e0ad strverscmp: migrate from "strverscmp.h" to <string.h>
Eric Blake <ebb9@byu.net>
parents: 9999
diff changeset
816 # endif
12942
17ee1f140456 string: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12766
diff changeset
817 _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
818 _GL_CXXALIASWARN (strverscmp);
10345
8d80c477e0ad strverscmp: migrate from "strverscmp.h" to <string.h>
Eric Blake <ebb9@byu.net>
parents: 9999
diff changeset
819 #elif defined GNULIB_POSIXCHECK
8d80c477e0ad strverscmp: migrate from "strverscmp.h" to <string.h>
Eric Blake <ebb9@byu.net>
parents: 9999
diff changeset
820 # undef strverscmp
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
821 # if HAVE_RAW_DECL_STRVERSCMP
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
822 _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
823 "use gnulib module strverscmp for portability");
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12602
diff changeset
824 # endif
10345
8d80c477e0ad strverscmp: migrate from "strverscmp.h" to <string.h>
Eric Blake <ebb9@byu.net>
parents: 9999
diff changeset
825 #endif
8d80c477e0ad strverscmp: migrate from "strverscmp.h" to <string.h>
Eric Blake <ebb9@byu.net>
parents: 9999
diff changeset
826
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
827
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
828 #endif /* _GL_STRING_H */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
829 #endif /* _GL_STRING_H */