GDBserver
string.h
Go to the documentation of this file.
1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 /* A GNU-like <string.h>.
3 
4  Copyright (C) 1995-1996, 2001-2016 Free Software Foundation, Inc.
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 3, or (at your option)
9  any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, see <http://www.gnu.org/licenses/>. */
18 
19 #if __GNUC__ >= 3
20 #pragma GCC system_header
21 #endif
22 
23 
24 #if defined _GL_ALREADY_INCLUDING_STRING_H
25 /* Special invocation convention:
26  - On OS X/NetBSD we have a sequence of nested includes
27  <string.h> -> <strings.h> -> "string.h"
28  In this situation system _chk variants due to -D_FORTIFY_SOURCE
29  might be used after any replacements defined here. */
30 
31 #include_next <string.h>
32 
33 #else
34 /* Normal invocation convention. */
35 
36 #ifndef _GL_STRING_H
37 
38 #define _GL_ALREADY_INCLUDING_STRING_H
39 
40 /* The include_next requires a split double-inclusion guard. */
41 #include_next <string.h>
42 
43 #undef _GL_ALREADY_INCLUDING_STRING_H
44 
45 #ifndef _GL_STRING_H
46 #define _GL_STRING_H
47 
48 /* NetBSD 5.0 mis-defines NULL. */
49 #include <stddef.h>
50 
51 /* MirBSD defines mbslen as a macro. */
52 #if 0 && defined __MirBSD__
53 # include <wchar.h>
54 #endif
55 
56 /* The __attribute__ feature is available in gcc versions 2.5 and later.
57  The attribute __pure__ was added in gcc 2.96. */
58 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
59 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
60 #else
61 # define _GL_ATTRIBUTE_PURE /* empty */
62 #endif
63 
64 /* NetBSD 5.0 declares strsignal in <unistd.h>, not in <string.h>. */
65 /* But in any case avoid namespace pollution on glibc systems. */
66 #if (0 || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \
67  && ! defined __GLIBC__
68 # include <unistd.h>
69 #endif
70 
71 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
72 #ifndef _GL_CXXDEFS_H
73 #define _GL_CXXDEFS_H
74 
75 /* Begin/end the GNULIB_NAMESPACE namespace. */
76 #if defined __cplusplus && defined GNULIB_NAMESPACE
77 # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
78 # define _GL_END_NAMESPACE }
79 #else
80 # define _GL_BEGIN_NAMESPACE
81 # define _GL_END_NAMESPACE
82 #endif
83 
84 /* The three most frequent use cases of these macros are:
85 
86  * For providing a substitute for a function that is missing on some
87  platforms, but is declared and works fine on the platforms on which
88  it exists:
89 
90  #if @GNULIB_FOO@
91  # if !@HAVE_FOO@
92  _GL_FUNCDECL_SYS (foo, ...);
93  # endif
94  _GL_CXXALIAS_SYS (foo, ...);
95  _GL_CXXALIASWARN (foo);
96  #elif defined GNULIB_POSIXCHECK
97  ...
98  #endif
99 
100  * For providing a replacement for a function that exists on all platforms,
101  but is broken/insufficient and needs to be replaced on some platforms:
102 
103  #if @GNULIB_FOO@
104  # if @REPLACE_FOO@
105  # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
106  # undef foo
107  # define foo rpl_foo
108  # endif
109  _GL_FUNCDECL_RPL (foo, ...);
110  _GL_CXXALIAS_RPL (foo, ...);
111  # else
112  _GL_CXXALIAS_SYS (foo, ...);
113  # endif
114  _GL_CXXALIASWARN (foo);
115  #elif defined GNULIB_POSIXCHECK
116  ...
117  #endif
118 
119  * For providing a replacement for a function that exists on some platforms
120  but is broken/insufficient and needs to be replaced on some of them and
121  is additionally either missing or undeclared on some other platforms:
122 
123  #if @GNULIB_FOO@
124  # if @REPLACE_FOO@
125  # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
126  # undef foo
127  # define foo rpl_foo
128  # endif
129  _GL_FUNCDECL_RPL (foo, ...);
130  _GL_CXXALIAS_RPL (foo, ...);
131  # else
132  # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
133  _GL_FUNCDECL_SYS (foo, ...);
134  # endif
135  _GL_CXXALIAS_SYS (foo, ...);
136  # endif
137  _GL_CXXALIASWARN (foo);
138  #elif defined GNULIB_POSIXCHECK
139  ...
140  #endif
141 */
142 
143 /* _GL_EXTERN_C declaration;
144  performs the declaration with C linkage. */
145 #if defined __cplusplus
146 # define _GL_EXTERN_C extern "C"
147 #else
148 # define _GL_EXTERN_C extern
149 #endif
150 
151 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
152  declares a replacement function, named rpl_func, with the given prototype,
153  consisting of return type, parameters, and attributes.
154  Example:
155  _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
156  _GL_ARG_NONNULL ((1)));
157  */
158 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
159  _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
160 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
161  _GL_EXTERN_C rettype rpl_func parameters_and_attributes
162 
163 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
164  declares the system function, named func, with the given prototype,
165  consisting of return type, parameters, and attributes.
166  Example:
167  _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
168  _GL_ARG_NONNULL ((1)));
169  */
170 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
171  _GL_EXTERN_C rettype func parameters_and_attributes
172 
173 /* _GL_CXXALIAS_RPL (func, rettype, parameters);
174  declares a C++ alias called GNULIB_NAMESPACE::func
175  that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
176  Example:
177  _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
178 
179  Wrapping rpl_func in an object with an inline conversion operator
180  avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
181  actually used in the program. */
182 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
183  _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
184 #if defined __cplusplus && defined GNULIB_NAMESPACE
185 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
186  namespace GNULIB_NAMESPACE \
187  { \
188  static const struct _gl_ ## func ## _wrapper \
189  { \
190  typedef rettype (*type) parameters; \
191  inline type rpl () const { return ::rpl_func; } \
192  inline operator type () const { return rpl (); } \
193  } func = {}; \
194  } \
195  _GL_EXTERN_C int _gl_cxxalias_dummy
196 #else
197 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
198  _GL_EXTERN_C int _gl_cxxalias_dummy
199 #endif
200 
201 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
202  is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
203  except that the C function rpl_func may have a slightly different
204  declaration. A cast is used to silence the "invalid conversion" error
205  that would otherwise occur. */
206 #if defined __cplusplus && defined GNULIB_NAMESPACE
207 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
208  namespace GNULIB_NAMESPACE \
209  { \
210  static const struct _gl_ ## func ## _wrapper \
211  { \
212  typedef rettype (*type) parameters; \
213  inline type rpl () const \
214  { return reinterpret_cast<type>(::rpl_func); } \
215  inline operator type () const { return rpl (); } \
216  } func = {}; \
217  } \
218  _GL_EXTERN_C int _gl_cxxalias_dummy
219 #else
220 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
221  _GL_EXTERN_C int _gl_cxxalias_dummy
222 #endif
223 
224 /* _GL_CXXALIAS_SYS (func, rettype, parameters);
225  declares a C++ alias called GNULIB_NAMESPACE::func
226  that redirects to the system provided function func, if GNULIB_NAMESPACE
227  is defined.
228  Example:
229  _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
230 
231  Wrapping func in an object with an inline conversion operator
232  avoids a reference to func unless GNULIB_NAMESPACE::func is
233  actually used in the program. */
234 #if defined __cplusplus && defined GNULIB_NAMESPACE
235 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
236  namespace GNULIB_NAMESPACE \
237  { \
238  static const struct _gl_ ## func ## _wrapper \
239  { \
240  typedef rettype (*type) parameters; \
241  inline type rpl () const { return ::func; } \
242  inline operator type () const { return rpl (); } \
243  } func = {}; \
244  } \
245  _GL_EXTERN_C int _gl_cxxalias_dummy
246 #else
247 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
248  _GL_EXTERN_C int _gl_cxxalias_dummy
249 #endif
250 
251 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
252  is like _GL_CXXALIAS_SYS (func, rettype, parameters);
253  except that the C function func may have a slightly different declaration.
254  A cast is used to silence the "invalid conversion" error that would
255  otherwise occur. */
256 #if defined __cplusplus && defined GNULIB_NAMESPACE
257 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
258  namespace GNULIB_NAMESPACE \
259  { \
260  static const struct _gl_ ## func ## _wrapper \
261  { \
262  typedef rettype (*type) parameters; \
263  inline type rpl () const \
264  { return reinterpret_cast<type>(::func); } \
265  inline operator type () const { return rpl (); }\
266  } func = {}; \
267  } \
268  _GL_EXTERN_C int _gl_cxxalias_dummy
269 #else
270 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
271  _GL_EXTERN_C int _gl_cxxalias_dummy
272 #endif
273 
274 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
275  is like _GL_CXXALIAS_SYS (func, rettype, parameters);
276  except that the C function is picked among a set of overloaded functions,
277  namely the one with rettype2 and parameters2. Two consecutive casts
278  are used to silence the "cannot find a match" and "invalid conversion"
279  errors that would otherwise occur. */
280 #if defined __cplusplus && defined GNULIB_NAMESPACE
281  /* The outer cast must be a reinterpret_cast.
282  The inner cast: When the function is defined as a set of overloaded
283  functions, it works as a static_cast<>, choosing the designated variant.
284  When the function is defined as a single variant, it works as a
285  reinterpret_cast<>. The parenthesized cast syntax works both ways. */
286 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
287  namespace GNULIB_NAMESPACE \
288  { \
289  static const struct _gl_ ## func ## _wrapper \
290  { \
291  typedef rettype (*type) parameters; \
292  \
293  inline type rpl () const \
294  { return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); }\
295  \
296  inline operator type () const { return rpl (); } \
297  } func = {}; \
298  } \
299  _GL_EXTERN_C int _gl_cxxalias_dummy
300 #else
301 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
302  _GL_EXTERN_C int _gl_cxxalias_dummy
303 #endif
304 
305 /* _GL_CXXALIASWARN (func);
306  causes a warning to be emitted when ::func is used but not when
307  GNULIB_NAMESPACE::func is used. func must be defined without overloaded
308  variants. */
309 #if defined __cplusplus && defined GNULIB_NAMESPACE
310 # define _GL_CXXALIASWARN(func) \
311  _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
312 # define _GL_CXXALIASWARN_1(func,namespace) \
313  _GL_CXXALIASWARN_2 (func, namespace)
314 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
315  we enable the warning only when not optimizing. */
316 # if !__OPTIMIZE__
317 # define _GL_CXXALIASWARN_2(func,namespace) \
318  _GL_WARN_ON_USE (func, \
319  "The symbol ::" #func " refers to the system function. " \
320  "Use " #namespace "::" #func " instead.")
321 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
322 # define _GL_CXXALIASWARN_2(func,namespace) \
323  extern __typeof__ (func) func
324 # else
325 # define _GL_CXXALIASWARN_2(func,namespace) \
326  _GL_EXTERN_C int _gl_cxxalias_dummy
327 # endif
328 #else
329 # define _GL_CXXALIASWARN(func) \
330  _GL_EXTERN_C int _gl_cxxalias_dummy
331 #endif
332 
333 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
334  causes a warning to be emitted when the given overloaded variant of ::func
335  is used but not when GNULIB_NAMESPACE::func is used. */
336 #if defined __cplusplus && defined GNULIB_NAMESPACE
337 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
338  _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
339  GNULIB_NAMESPACE)
340 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
341  _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
342 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
343  we enable the warning only when not optimizing. */
344 # if !__OPTIMIZE__
345 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
346  _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
347  "The symbol ::" #func " refers to the system function. " \
348  "Use " #namespace "::" #func " instead.")
349 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
350 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
351  extern __typeof__ (func) func
352 # else
353 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
354  _GL_EXTERN_C int _gl_cxxalias_dummy
355 # endif
356 #else
357 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
358  _GL_EXTERN_C int _gl_cxxalias_dummy
359 #endif
360 
361 #endif /* _GL_CXXDEFS_H */
362 
363 /* The definition of _GL_ARG_NONNULL is copied here. */
364 /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
365  that the values passed as arguments n, ..., m must be non-NULL pointers.
366  n = 1 stands for the first argument, n = 2 for the second argument etc. */
367 #ifndef _GL_ARG_NONNULL
368 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
369 # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
370 # else
371 # define _GL_ARG_NONNULL(params)
372 # endif
373 #endif
374 
375 /* The definition of _GL_WARN_ON_USE is copied here. */
376 #ifndef _GL_WARN_ON_USE
377 
378 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
379 /* A compiler attribute is available in gcc versions 4.3.0 and later. */
380 # define _GL_WARN_ON_USE(function, message) \
381 extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
382 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
383 /* Verify the existence of the function. */
384 # define _GL_WARN_ON_USE(function, message) \
385 extern __typeof__ (function) function
386 # else /* Unsupported. */
387 # define _GL_WARN_ON_USE(function, message) \
388 _GL_WARN_EXTERN_C int _gl_warn_on_use
389 # endif
390 #endif
391 
392 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
393  is like _GL_WARN_ON_USE (function, "string"), except that the function is
394  declared with the given prototype, consisting of return type, parameters,
395  and attributes.
396  This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
397  not work in this case. */
398 #ifndef _GL_WARN_ON_USE_CXX
399 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
400 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
401 extern rettype function parameters_and_attributes \
402  __attribute__ ((__warning__ (msg)))
403 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
404 /* Verify the existence of the function. */
405 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
406 extern rettype function parameters_and_attributes
407 # else /* Unsupported. */
408 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
409 _GL_WARN_EXTERN_C int _gl_warn_on_use
410 # endif
411 #endif
412 
413 /* _GL_WARN_EXTERN_C declaration;
414  performs the declaration with C linkage. */
415 #ifndef _GL_WARN_EXTERN_C
416 # if defined __cplusplus
417 # define _GL_WARN_EXTERN_C extern "C"
418 # else
419 # define _GL_WARN_EXTERN_C extern
420 # endif
421 #endif
422 
423 
424 /* Find the index of the least-significant set bit. */
425 #if 0
426 # if !1
427 _GL_FUNCDECL_SYS (ffsl, int, (long int i));
428 # endif
429 _GL_CXXALIAS_SYS (ffsl, int, (long int i));
430 _GL_CXXALIASWARN (ffsl);
431 #elif defined GNULIB_POSIXCHECK
432 # undef ffsl
433 # if HAVE_RAW_DECL_FFSL
434 _GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module");
435 # endif
436 #endif
437 
438 
439 /* Find the index of the least-significant set bit. */
440 #if 0
441 # if !1
442 _GL_FUNCDECL_SYS (ffsll, int, (long long int i));
443 # endif
444 _GL_CXXALIAS_SYS (ffsll, int, (long long int i));
445 _GL_CXXALIASWARN (ffsll);
446 #elif defined GNULIB_POSIXCHECK
447 # undef ffsll
448 # if HAVE_RAW_DECL_FFSLL
449 _GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module");
450 # endif
451 #endif
452 
453 
454 /* Return the first instance of C within N bytes of S, or NULL. */
455 #if 1
456 # if 0
457 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
458 # define memchr rpl_memchr
459 # endif
460 _GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n)
462  _GL_ARG_NONNULL ((1)));
463 _GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n));
464 # else
465 # if ! 1
466 _GL_FUNCDECL_SYS (memchr, void *, (void const *__s, int __c, size_t __n)
468  _GL_ARG_NONNULL ((1)));
469 # endif
470  /* On some systems, this function is defined as an overloaded function:
471  extern "C" { const void * std::memchr (const void *, int, size_t); }
472  extern "C++" { void * std::memchr (void *, int, size_t); } */
473 _GL_CXXALIAS_SYS_CAST2 (memchr,
474  void *, (void const *__s, int __c, size_t __n),
475  void const *, (void const *__s, int __c, size_t __n));
476 # endif
477 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
478  && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
479 _GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n));
480 _GL_CXXALIASWARN1 (memchr, void const *,
481  (void const *__s, int __c, size_t __n));
482 # else
483 _GL_CXXALIASWARN (memchr);
484 # endif
485 #elif defined GNULIB_POSIXCHECK
486 # undef memchr
487 /* Assume memchr is always declared. */
488 _GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - "
489  "use gnulib module memchr for portability" );
490 #endif
491 
492 /* Return the first occurrence of NEEDLE in HAYSTACK. */
493 #if 1
494 # if 0
495 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
496 # define memmem rpl_memmem
497 # endif
498 _GL_FUNCDECL_RPL (memmem, void *,
499  (void const *__haystack, size_t __haystack_len,
500  void const *__needle, size_t __needle_len)
502  _GL_ARG_NONNULL ((1, 3)));
503 _GL_CXXALIAS_RPL (memmem, void *,
504  (void const *__haystack, size_t __haystack_len,
505  void const *__needle, size_t __needle_len));
506 # else
507 # if ! 1
508 _GL_FUNCDECL_SYS (memmem, void *,
509  (void const *__haystack, size_t __haystack_len,
510  void const *__needle, size_t __needle_len)
512  _GL_ARG_NONNULL ((1, 3)));
513 # endif
514 _GL_CXXALIAS_SYS (memmem, void *,
515  (void const *__haystack, size_t __haystack_len,
516  void const *__needle, size_t __needle_len));
517 # endif
518 _GL_CXXALIASWARN (memmem);
519 #elif defined GNULIB_POSIXCHECK
520 # undef memmem
521 # if HAVE_RAW_DECL_MEMMEM
522 _GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - "
523  "use gnulib module memmem-simple for portability, "
524  "and module memmem for speed" );
525 # endif
526 #endif
527 
528 /* Copy N bytes of SRC to DEST, return pointer to bytes after the
529  last written byte. */
530 #if 1
531 # if ! 1
532 _GL_FUNCDECL_SYS (mempcpy, void *,
533  (void *restrict __dest, void const *restrict __src,
534  size_t __n)
535  _GL_ARG_NONNULL ((1, 2)));
536 # endif
537 _GL_CXXALIAS_SYS (mempcpy, void *,
538  (void *restrict __dest, void const *restrict __src,
539  size_t __n));
540 _GL_CXXALIASWARN (mempcpy);
541 #elif defined GNULIB_POSIXCHECK
542 # undef mempcpy
543 # if HAVE_RAW_DECL_MEMPCPY
544 _GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - "
545  "use gnulib module mempcpy for portability");
546 # endif
547 #endif
548 
549 /* Search backwards through a block for a byte (specified as an int). */
550 #if 1
551 # if ! 1
552 _GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t)
554  _GL_ARG_NONNULL ((1)));
555 # endif
556  /* On some systems, this function is defined as an overloaded function:
557  extern "C++" { const void * std::memrchr (const void *, int, size_t); }
558  extern "C++" { void * std::memrchr (void *, int, size_t); } */
559 _GL_CXXALIAS_SYS_CAST2 (memrchr,
560  void *, (void const *, int, size_t),
561  void const *, (void const *, int, size_t));
562 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
563  && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
564 _GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t));
565 _GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t));
566 # else
567 _GL_CXXALIASWARN (memrchr);
568 # endif
569 #elif defined GNULIB_POSIXCHECK
570 # undef memrchr
571 # if HAVE_RAW_DECL_MEMRCHR
572 _GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
573  "use gnulib module memrchr for portability");
574 # endif
575 #endif
576 
577 /* Find the first occurrence of C in S. More efficient than
578  memchr(S,C,N), at the expense of undefined behavior if C does not
579  occur within N bytes. */
580 #if 1
581 # if ! 1
582 _GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in)
584  _GL_ARG_NONNULL ((1)));
585 # endif
586  /* On some systems, this function is defined as an overloaded function:
587  extern "C++" { const void * std::rawmemchr (const void *, int); }
588  extern "C++" { void * std::rawmemchr (void *, int); } */
589 _GL_CXXALIAS_SYS_CAST2 (rawmemchr,
590  void *, (void const *__s, int __c_in),
591  void const *, (void const *__s, int __c_in));
592 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
593  && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
594 _GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in));
595 _GL_CXXALIASWARN1 (rawmemchr, void const *, (void const *__s, int __c_in));
596 # else
597 _GL_CXXALIASWARN (rawmemchr);
598 # endif
599 #elif defined GNULIB_POSIXCHECK
600 # undef rawmemchr
601 # if HAVE_RAW_DECL_RAWMEMCHR
602 _GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - "
603  "use gnulib module rawmemchr for portability");
604 # endif
605 #endif
606 
607 /* Copy SRC to DST, returning the address of the terminating '\0' in DST. */
608 #if 0
609 # if ! 1
610 _GL_FUNCDECL_SYS (stpcpy, char *,
611  (char *restrict __dst, char const *restrict __src)
612  _GL_ARG_NONNULL ((1, 2)));
613 # endif
614 _GL_CXXALIAS_SYS (stpcpy, char *,
615  (char *restrict __dst, char const *restrict __src));
616 _GL_CXXALIASWARN (stpcpy);
617 #elif defined GNULIB_POSIXCHECK
618 # undef stpcpy
619 # if HAVE_RAW_DECL_STPCPY
620 _GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - "
621  "use gnulib module stpcpy for portability");
622 # endif
623 #endif
624 
625 /* Copy no more than N bytes of SRC to DST, returning a pointer past the
626  last non-NUL byte written into DST. */
627 #if 0
628 # if 0
629 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
630 # undef stpncpy
631 # define stpncpy rpl_stpncpy
632 # endif
633 _GL_FUNCDECL_RPL (stpncpy, char *,
634  (char *restrict __dst, char const *restrict __src,
635  size_t __n)
636  _GL_ARG_NONNULL ((1, 2)));
637 _GL_CXXALIAS_RPL (stpncpy, char *,
638  (char *restrict __dst, char const *restrict __src,
639  size_t __n));
640 # else
641 # if ! 1
642 _GL_FUNCDECL_SYS (stpncpy, char *,
643  (char *restrict __dst, char const *restrict __src,
644  size_t __n)
645  _GL_ARG_NONNULL ((1, 2)));
646 # endif
647 _GL_CXXALIAS_SYS (stpncpy, char *,
648  (char *restrict __dst, char const *restrict __src,
649  size_t __n));
650 # endif
651 _GL_CXXALIASWARN (stpncpy);
652 #elif defined GNULIB_POSIXCHECK
653 # undef stpncpy
654 # if HAVE_RAW_DECL_STPNCPY
655 _GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - "
656  "use gnulib module stpncpy for portability");
657 # endif
658 #endif
659 
660 #if defined GNULIB_POSIXCHECK
661 /* strchr() does not work with multibyte strings if the locale encoding is
662  GB18030 and the character to be searched is a digit. */
663 # undef strchr
664 /* Assume strchr is always declared. */
665 _GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings "
666  "in some multibyte locales - "
667  "use mbschr if you care about internationalization");
668 #endif
669 
670 /* Find the first occurrence of C in S or the final NUL byte. */
671 #if 1
672 # if 0
673 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
674 # define strchrnul rpl_strchrnul
675 # endif
676 _GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in)
678  _GL_ARG_NONNULL ((1)));
679 _GL_CXXALIAS_RPL (strchrnul, char *,
680  (const char *str, int ch));
681 # else
682 # if ! 1
683 _GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in)
685  _GL_ARG_NONNULL ((1)));
686 # endif
687  /* On some systems, this function is defined as an overloaded function:
688  extern "C++" { const char * std::strchrnul (const char *, int); }
689  extern "C++" { char * std::strchrnul (char *, int); } */
690 _GL_CXXALIAS_SYS_CAST2 (strchrnul,
691  char *, (char const *__s, int __c_in),
692  char const *, (char const *__s, int __c_in));
693 # endif
694 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
695  && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
696 _GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in));
697 _GL_CXXALIASWARN1 (strchrnul, char const *, (char const *__s, int __c_in));
698 # else
699 _GL_CXXALIASWARN (strchrnul);
700 # endif
701 #elif defined GNULIB_POSIXCHECK
702 # undef strchrnul
703 # if HAVE_RAW_DECL_STRCHRNUL
704 _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
705  "use gnulib module strchrnul for portability");
706 # endif
707 #endif
708 
709 /* Duplicate S, returning an identical malloc'd string. */
710 #if 1
711 # if 0
712 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
713 # undef strdup
714 # define strdup rpl_strdup
715 # endif
716 _GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
717 _GL_CXXALIAS_RPL (strdup, char *, (char const *__s));
718 # else
719 # if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
720  /* strdup exists as a function and as a macro. Get rid of the macro. */
721 # undef strdup
722 # endif
723 # if !(1 || defined strdup)
724 _GL_FUNCDECL_SYS (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
725 # endif
726 _GL_CXXALIAS_SYS (strdup, char *, (char const *__s));
727 # endif
728 _GL_CXXALIASWARN (strdup);
729 #elif defined GNULIB_POSIXCHECK
730 # undef strdup
731 # if HAVE_RAW_DECL_STRDUP
732 _GL_WARN_ON_USE (strdup, "strdup is unportable - "
733  "use gnulib module strdup for portability");
734 # endif
735 #endif
736 
737 /* Append no more than N characters from SRC onto DEST. */
738 #if 0
739 # if 0
740 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
741 # undef strncat
742 # define strncat rpl_strncat
743 # endif
744 _GL_FUNCDECL_RPL (strncat, char *, (char *dest, const char *src, size_t n)
745  _GL_ARG_NONNULL ((1, 2)));
746 _GL_CXXALIAS_RPL (strncat, char *, (char *dest, const char *src, size_t n));
747 # else
748 _GL_CXXALIAS_SYS (strncat, char *, (char *dest, const char *src, size_t n));
749 # endif
750 _GL_CXXALIASWARN (strncat);
751 #elif defined GNULIB_POSIXCHECK
752 # undef strncat
753 # if HAVE_RAW_DECL_STRNCAT
754 _GL_WARN_ON_USE (strncat, "strncat is unportable - "
755  "use gnulib module strncat for portability");
756 # endif
757 #endif
758 
759 /* Return a newly allocated copy of at most N bytes of STRING. */
760 #if 0
761 # if 0
762 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
763 # undef strndup
764 # define strndup rpl_strndup
765 # endif
766 _GL_FUNCDECL_RPL (strndup, char *, (char const *__s, size_t __n)
767  _GL_ARG_NONNULL ((1)));
768 _GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n));
769 # else
770 # if ! 1
771 _GL_FUNCDECL_SYS (strndup, char *, (char const *__s, size_t __n)
772  _GL_ARG_NONNULL ((1)));
773 # endif
774 _GL_CXXALIAS_SYS (strndup, char *, (char const *__s, size_t __n));
775 # endif
776 _GL_CXXALIASWARN (strndup);
777 #elif defined GNULIB_POSIXCHECK
778 # undef strndup
779 # if HAVE_RAW_DECL_STRNDUP
780 _GL_WARN_ON_USE (strndup, "strndup is unportable - "
781  "use gnulib module strndup for portability");
782 # endif
783 #endif
784 
785 /* Find the length (number of bytes) of STRING, but scan at most
786  MAXLEN bytes. If no '\0' terminator is found in that many bytes,
787  return MAXLEN. */
788 #if 0
789 # if 0
790 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
791 # undef strnlen
792 # define strnlen rpl_strnlen
793 # endif
794 _GL_FUNCDECL_RPL (strnlen, size_t, (char const *__s, size_t __maxlen)
796  _GL_ARG_NONNULL ((1)));
797 _GL_CXXALIAS_RPL (strnlen, size_t, (char const *__s, size_t __maxlen));
798 # else
799 # if ! 1
800 _GL_FUNCDECL_SYS (strnlen, size_t, (char const *__s, size_t __maxlen)
802  _GL_ARG_NONNULL ((1)));
803 # endif
804 _GL_CXXALIAS_SYS (strnlen, size_t, (char const *__s, size_t __maxlen));
805 # endif
806 _GL_CXXALIASWARN (strnlen);
807 #elif defined GNULIB_POSIXCHECK
808 # undef strnlen
809 # if HAVE_RAW_DECL_STRNLEN
810 _GL_WARN_ON_USE (strnlen, "strnlen is unportable - "
811  "use gnulib module strnlen for portability");
812 # endif
813 #endif
814 
815 #if defined GNULIB_POSIXCHECK
816 /* strcspn() assumes the second argument is a list of single-byte characters.
817  Even in this simple case, it does not work with multibyte strings if the
818  locale encoding is GB18030 and one of the characters to be searched is a
819  digit. */
820 # undef strcspn
821 /* Assume strcspn is always declared. */
822 _GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings "
823  "in multibyte locales - "
824  "use mbscspn if you care about internationalization");
825 #endif
826 
827 /* Find the first occurrence in S of any character in ACCEPT. */
828 #if 0
829 # if ! 1
830 _GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept)
832  _GL_ARG_NONNULL ((1, 2)));
833 # endif
834  /* On some systems, this function is defined as an overloaded function:
835  extern "C" { const char * strpbrk (const char *, const char *); }
836  extern "C++" { char * strpbrk (char *, const char *); } */
837 _GL_CXXALIAS_SYS_CAST2 (strpbrk,
838  char *, (char const *__s, char const *__accept),
839  const char *, (char const *__s, char const *__accept));
840 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
841  && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
842 _GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept));
843 _GL_CXXALIASWARN1 (strpbrk, char const *,
844  (char const *__s, char const *__accept));
845 # else
846 _GL_CXXALIASWARN (strpbrk);
847 # endif
848 # if defined GNULIB_POSIXCHECK
849 /* strpbrk() assumes the second argument is a list of single-byte characters.
850  Even in this simple case, it does not work with multibyte strings if the
851  locale encoding is GB18030 and one of the characters to be searched is a
852  digit. */
853 # undef strpbrk
854 _GL_WARN_ON_USE (strpbrk, "strpbrk cannot work correctly on character strings "
855  "in multibyte locales - "
856  "use mbspbrk if you care about internationalization");
857 # endif
858 #elif defined GNULIB_POSIXCHECK
859 # undef strpbrk
860 # if HAVE_RAW_DECL_STRPBRK
861 _GL_WARN_ON_USE (strpbrk, "strpbrk is unportable - "
862  "use gnulib module strpbrk for portability");
863 # endif
864 #endif
865 
866 #if defined GNULIB_POSIXCHECK
867 /* strspn() assumes the second argument is a list of single-byte characters.
868  Even in this simple case, it cannot work with multibyte strings. */
869 # undef strspn
870 /* Assume strspn is always declared. */
871 _GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings "
872  "in multibyte locales - "
873  "use mbsspn if you care about internationalization");
874 #endif
875 
876 #if defined GNULIB_POSIXCHECK
877 /* strrchr() does not work with multibyte strings if the locale encoding is
878  GB18030 and the character to be searched is a digit. */
879 # undef strrchr
880 /* Assume strrchr is always declared. */
881 _GL_WARN_ON_USE (strrchr, "strrchr cannot work correctly on character strings "
882  "in some multibyte locales - "
883  "use mbsrchr if you care about internationalization");
884 #endif
885 
886 /* Search the next delimiter (char listed in DELIM) starting at *STRINGP.
887  If one is found, overwrite it with a NUL, and advance *STRINGP
888  to point to the next char after it. Otherwise, set *STRINGP to NULL.
889  If *STRINGP was already NULL, nothing happens.
890  Return the old value of *STRINGP.
891 
892  This is a variant of strtok() that is multithread-safe and supports
893  empty fields.
894 
895  Caveat: It modifies the original string.
896  Caveat: These functions cannot be used on constant strings.
897  Caveat: The identity of the delimiting character is lost.
898  Caveat: It doesn't work with multibyte strings unless all of the delimiter
899  characters are ASCII characters < 0x30.
900 
901  See also strtok_r(). */
902 #if 0
903 # if ! 1
904 _GL_FUNCDECL_SYS (strsep, char *,
905  (char **restrict __stringp, char const *restrict __delim)
906  _GL_ARG_NONNULL ((1, 2)));
907 # endif
908 _GL_CXXALIAS_SYS (strsep, char *,
909  (char **restrict __stringp, char const *restrict __delim));
910 _GL_CXXALIASWARN (strsep);
911 # if defined GNULIB_POSIXCHECK
912 # undef strsep
913 _GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings "
914  "in multibyte locales - "
915  "use mbssep if you care about internationalization");
916 # endif
917 #elif defined GNULIB_POSIXCHECK
918 # undef strsep
919 # if HAVE_RAW_DECL_STRSEP
920 _GL_WARN_ON_USE (strsep, "strsep is unportable - "
921  "use gnulib module strsep for portability");
922 # endif
923 #endif
924 
925 #if 1
926 # if 0
927 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
928 # define strstr rpl_strstr
929 # endif
930 _GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle)
932  _GL_ARG_NONNULL ((1, 2)));
933 _GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle));
934 # else
935  /* On some systems, this function is defined as an overloaded function:
936  extern "C++" { const char * strstr (const char *, const char *); }
937  extern "C++" { char * strstr (char *, const char *); } */
938 _GL_CXXALIAS_SYS_CAST2 (strstr,
939  char *, (const char *haystack, const char *needle),
940  const char *, (const char *haystack, const char *needle));
941 # endif
942 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
943  && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
944 _GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle));
945 _GL_CXXALIASWARN1 (strstr, const char *,
946  (const char *haystack, const char *needle));
947 # else
948 _GL_CXXALIASWARN (strstr);
949 # endif
950 #elif defined GNULIB_POSIXCHECK
951 /* strstr() does not work with multibyte strings if the locale encoding is
952  different from UTF-8:
953  POSIX says that it operates on "strings", and "string" in POSIX is defined
954  as a sequence of bytes, not of characters. */
955 # undef strstr
956 /* Assume strstr is always declared. */
957 _GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot "
958  "work correctly on character strings in most "
959  "multibyte locales - "
960  "use mbsstr if you care about internationalization, "
961  "or use strstr if you care about speed");
962 #endif
963 
964 /* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
965  comparison. */
966 #if 0
967 # if 0
968 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
969 # define strcasestr rpl_strcasestr
970 # endif
971 _GL_FUNCDECL_RPL (strcasestr, char *,
972  (const char *haystack, const char *needle)
974  _GL_ARG_NONNULL ((1, 2)));
975 _GL_CXXALIAS_RPL (strcasestr, char *,
976  (const char *haystack, const char *needle));
977 # else
978 # if ! 1
979 _GL_FUNCDECL_SYS (strcasestr, char *,
980  (const char *haystack, const char *needle)
982  _GL_ARG_NONNULL ((1, 2)));
983 # endif
984  /* On some systems, this function is defined as an overloaded function:
985  extern "C++" { const char * strcasestr (const char *, const char *); }
986  extern "C++" { char * strcasestr (char *, const char *); } */
987 _GL_CXXALIAS_SYS_CAST2 (strcasestr,
988  char *, (const char *haystack, const char *needle),
989  const char *, (const char *haystack, const char *needle));
990 # endif
991 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
992  && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
993 _GL_CXXALIASWARN1 (strcasestr, char *, (char *haystack, const char *needle));
994 _GL_CXXALIASWARN1 (strcasestr, const char *,
995  (const char *haystack, const char *needle));
996 # else
997 _GL_CXXALIASWARN (strcasestr);
998 # endif
999 #elif defined GNULIB_POSIXCHECK
1000 /* strcasestr() does not work with multibyte strings:
1001  It is a glibc extension, and glibc implements it only for unibyte
1002  locales. */
1003 # undef strcasestr
1004 # if HAVE_RAW_DECL_STRCASESTR
1005 _GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character "
1006  "strings in multibyte locales - "
1007  "use mbscasestr if you care about "
1008  "internationalization, or use c-strcasestr if you want "
1009  "a locale independent function");
1010 # endif
1011 #endif
1012 
1013 /* Parse S into tokens separated by characters in DELIM.
1014  If S is NULL, the saved pointer in SAVE_PTR is used as
1015  the next starting point. For example:
1016  char s[] = "-abc-=-def";
1017  char *sp;
1018  x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def"
1019  x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL
1020  x = strtok_r(NULL, "=", &sp); // x = NULL
1021  // s = "abc\0-def\0"
1022 
1023  This is a variant of strtok() that is multithread-safe.
1024 
1025  For the POSIX documentation for this function, see:
1026  http://www.opengroup.org/susv3xsh/strtok.html
1027 
1028  Caveat: It modifies the original string.
1029  Caveat: These functions cannot be used on constant strings.
1030  Caveat: The identity of the delimiting character is lost.
1031  Caveat: It doesn't work with multibyte strings unless all of the delimiter
1032  characters are ASCII characters < 0x30.
1033 
1034  See also strsep(). */
1035 #if 1
1036 # if 0
1037 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1038 # undef strtok_r
1039 # define strtok_r rpl_strtok_r
1040 # endif
1041 _GL_FUNCDECL_RPL (strtok_r, char *,
1042  (char *restrict s, char const *restrict delim,
1043  char **restrict save_ptr)
1044  _GL_ARG_NONNULL ((2, 3)));
1045 _GL_CXXALIAS_RPL (strtok_r, char *,
1046  (char *restrict s, char const *restrict delim,
1047  char **restrict save_ptr));
1048 # else
1049 # if 0 || defined GNULIB_POSIXCHECK
1050 # undef strtok_r
1051 # endif
1052 # if ! 1
1053 _GL_FUNCDECL_SYS (strtok_r, char *,
1054  (char *restrict s, char const *restrict delim,
1055  char **restrict save_ptr)
1056  _GL_ARG_NONNULL ((2, 3)));
1057 # endif
1058 _GL_CXXALIAS_SYS (strtok_r, char *,
1059  (char *restrict s, char const *restrict delim,
1060  char **restrict save_ptr));
1061 # endif
1062 _GL_CXXALIASWARN (strtok_r);
1063 # if defined GNULIB_POSIXCHECK
1064 _GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character "
1065  "strings in multibyte locales - "
1066  "use mbstok_r if you care about internationalization");
1067 # endif
1068 #elif defined GNULIB_POSIXCHECK
1069 # undef strtok_r
1070 # if HAVE_RAW_DECL_STRTOK_R
1071 _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
1072  "use gnulib module strtok_r for portability");
1073 # endif
1074 #endif
1075 
1076 
1077 /* The following functions are not specified by POSIX. They are gnulib
1078  extensions. */
1079 
1080 #if 0
1081 /* Return the number of multibyte characters in the character string STRING.
1082  This considers multibyte characters, unlike strlen, which counts bytes. */
1083 # ifdef __MirBSD__ /* MirBSD defines mbslen as a macro. Override it. */
1084 # undef mbslen
1085 # endif
1086 # if 0 /* AIX, OSF/1, MirBSD define mbslen already in libc. */
1087 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1088 # define mbslen rpl_mbslen
1089 # endif
1090 _GL_FUNCDECL_RPL (mbslen, size_t, (const char *string)
1092  _GL_ARG_NONNULL ((1)));
1093 _GL_CXXALIAS_RPL (mbslen, size_t, (const char *string));
1094 # else
1095 _GL_FUNCDECL_SYS (mbslen, size_t, (const char *string)
1097  _GL_ARG_NONNULL ((1)));
1098 _GL_CXXALIAS_SYS (mbslen, size_t, (const char *string));
1099 # endif
1100 _GL_CXXALIASWARN (mbslen);
1101 #endif
1102 
1103 #if 0
1104 /* Return the number of multibyte characters in the character string starting
1105  at STRING and ending at STRING + LEN. */
1106 _GL_EXTERN_C size_t mbsnlen (const char *string, size_t len)
1108  _GL_ARG_NONNULL ((1));
1109 #endif
1110 
1111 #if 0
1112 /* Locate the first single-byte character C in the character string STRING,
1113  and return a pointer to it. Return NULL if C is not found in STRING.
1114  Unlike strchr(), this function works correctly in multibyte locales with
1115  encodings such as GB18030. */
1116 # if defined __hpux
1117 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1118 # define mbschr rpl_mbschr /* avoid collision with HP-UX function */
1119 # endif
1120 _GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c)
1122  _GL_ARG_NONNULL ((1)));
1123 _GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c));
1124 # else
1125 _GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c)
1127  _GL_ARG_NONNULL ((1)));
1128 _GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c));
1129 # endif
1130 _GL_CXXALIASWARN (mbschr);
1131 #endif
1132 
1133 #if 0
1134 /* Locate the last single-byte character C in the character string STRING,
1135  and return a pointer to it. Return NULL if C is not found in STRING.
1136  Unlike strrchr(), this function works correctly in multibyte locales with
1137  encodings such as GB18030. */
1138 # if defined __hpux || defined __INTERIX
1139 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1140 # define mbsrchr rpl_mbsrchr /* avoid collision with system function */
1141 # endif
1142 _GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c)
1144  _GL_ARG_NONNULL ((1)));
1145 _GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c));
1146 # else
1147 _GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c)
1149  _GL_ARG_NONNULL ((1)));
1150 _GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c));
1151 # endif
1152 _GL_CXXALIASWARN (mbsrchr);
1153 #endif
1154 
1155 #if 0
1156 /* Find the first occurrence of the character string NEEDLE in the character
1157  string HAYSTACK. Return NULL if NEEDLE is not found in HAYSTACK.
1158  Unlike strstr(), this function works correctly in multibyte locales with
1159  encodings different from UTF-8. */
1160 _GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle)
1162  _GL_ARG_NONNULL ((1, 2));
1163 #endif
1164 
1165 #if 0
1166 /* Compare the character strings S1 and S2, ignoring case, returning less than,
1167  equal to or greater than zero if S1 is lexicographically less than, equal to
1168  or greater than S2.
1169  Note: This function may, in multibyte locales, return 0 for strings of
1170  different lengths!
1171  Unlike strcasecmp(), this function works correctly in multibyte locales. */
1172 _GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2)
1174  _GL_ARG_NONNULL ((1, 2));
1175 #endif
1176 
1177 #if 0
1178 /* Compare the initial segment of the character string S1 consisting of at most
1179  N characters with the initial segment of the character string S2 consisting
1180  of at most N characters, ignoring case, returning less than, equal to or
1181  greater than zero if the initial segment of S1 is lexicographically less
1182  than, equal to or greater than the initial segment of S2.
1183  Note: This function may, in multibyte locales, return 0 for initial segments
1184  of different lengths!
1185  Unlike strncasecmp(), this function works correctly in multibyte locales.
1186  But beware that N is not a byte count but a character count! */
1187 _GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n)
1189  _GL_ARG_NONNULL ((1, 2));
1190 #endif
1191 
1192 #if 0
1193 /* Compare the initial segment of the character string STRING consisting of
1194  at most mbslen (PREFIX) characters with the character string PREFIX,
1195  ignoring case. If the two match, return a pointer to the first byte
1196  after this prefix in STRING. Otherwise, return NULL.
1197  Note: This function may, in multibyte locales, return non-NULL if STRING
1198  is of smaller length than PREFIX!
1199  Unlike strncasecmp(), this function works correctly in multibyte
1200  locales. */
1201 _GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
1203  _GL_ARG_NONNULL ((1, 2));
1204 #endif
1205 
1206 #if 0
1207 /* Find the first occurrence of the character string NEEDLE in the character
1208  string HAYSTACK, using case-insensitive comparison.
1209  Note: This function may, in multibyte locales, return success even if
1210  strlen (haystack) < strlen (needle) !
1211  Unlike strcasestr(), this function works correctly in multibyte locales. */
1212 _GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle)
1214  _GL_ARG_NONNULL ((1, 2));
1215 #endif
1216 
1217 #if 0
1218 /* Find the first occurrence in the character string STRING of any character
1219  in the character string ACCEPT. Return the number of bytes from the
1220  beginning of the string to this occurrence, or to the end of the string
1221  if none exists.
1222  Unlike strcspn(), this function works correctly in multibyte locales. */
1223 _GL_EXTERN_C size_t mbscspn (const char *string, const char *accept)
1225  _GL_ARG_NONNULL ((1, 2));
1226 #endif
1227 
1228 #if 0
1229 /* Find the first occurrence in the character string STRING of any character
1230  in the character string ACCEPT. Return the pointer to it, or NULL if none
1231  exists.
1232  Unlike strpbrk(), this function works correctly in multibyte locales. */
1233 # if defined __hpux
1234 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1235 # define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
1236 # endif
1237 _GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept)
1239  _GL_ARG_NONNULL ((1, 2)));
1240 _GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept));
1241 # else
1242 _GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept)
1244  _GL_ARG_NONNULL ((1, 2)));
1245 _GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept));
1246 # endif
1247 _GL_CXXALIASWARN (mbspbrk);
1248 #endif
1249 
1250 #if 0
1251 /* Find the first occurrence in the character string STRING of any character
1252  not in the character string REJECT. Return the number of bytes from the
1253  beginning of the string to this occurrence, or to the end of the string
1254  if none exists.
1255  Unlike strspn(), this function works correctly in multibyte locales. */
1256 _GL_EXTERN_C size_t mbsspn (const char *string, const char *reject)
1258  _GL_ARG_NONNULL ((1, 2));
1259 #endif
1260 
1261 #if 0
1262 /* Search the next delimiter (multibyte character listed in the character
1263  string DELIM) starting at the character string *STRINGP.
1264  If one is found, overwrite it with a NUL, and advance *STRINGP to point
1265  to the next multibyte character after it. Otherwise, set *STRINGP to NULL.
1266  If *STRINGP was already NULL, nothing happens.
1267  Return the old value of *STRINGP.
1268 
1269  This is a variant of mbstok_r() that supports empty fields.
1270 
1271  Caveat: It modifies the original string.
1272  Caveat: These functions cannot be used on constant strings.
1273  Caveat: The identity of the delimiting character is lost.
1274 
1275  See also mbstok_r(). */
1276 _GL_EXTERN_C char * mbssep (char **stringp, const char *delim)
1277  _GL_ARG_NONNULL ((1, 2));
1278 #endif
1279 
1280 #if 0
1281 /* Parse the character string STRING into tokens separated by characters in
1282  the character string DELIM.
1283  If STRING is NULL, the saved pointer in SAVE_PTR is used as
1284  the next starting point. For example:
1285  char s[] = "-abc-=-def";
1286  char *sp;
1287  x = mbstok_r(s, "-", &sp); // x = "abc", sp = "=-def"
1288  x = mbstok_r(NULL, "-=", &sp); // x = "def", sp = NULL
1289  x = mbstok_r(NULL, "=", &sp); // x = NULL
1290  // s = "abc\0-def\0"
1291 
1292  Caveat: It modifies the original string.
1293  Caveat: These functions cannot be used on constant strings.
1294  Caveat: The identity of the delimiting character is lost.
1295 
1296  See also mbssep(). */
1297 _GL_EXTERN_C char * mbstok_r (char *string, const char *delim, char **save_ptr)
1298  _GL_ARG_NONNULL ((2, 3));
1299 #endif
1300 
1301 /* Map any int, typically from errno, into an error message. */
1302 #if 1
1303 # if 0
1304 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1305 # undef strerror
1306 # define strerror rpl_strerror
1307 # endif
1308 _GL_FUNCDECL_RPL (strerror, char *, (int));
1309 _GL_CXXALIAS_RPL (strerror, char *, (int));
1310 # else
1311 _GL_CXXALIAS_SYS (strerror, char *, (int));
1312 # endif
1314 #elif defined GNULIB_POSIXCHECK
1315 # undef strerror
1316 /* Assume strerror is always declared. */
1317 _GL_WARN_ON_USE (strerror, "strerror is unportable - "
1318  "use gnulib module strerror to guarantee non-NULL result");
1319 #endif
1320 
1321 /* Map any int, typically from errno, into an error message. Multithread-safe.
1322  Uses the POSIX declaration, not the glibc declaration. */
1323 #if 0
1324 # if 0
1325 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1326 # undef strerror_r
1327 # define strerror_r rpl_strerror_r
1328 # endif
1329 _GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen)
1330  _GL_ARG_NONNULL ((2)));
1331 _GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen));
1332 # else
1333 # if !1
1334 _GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)
1335  _GL_ARG_NONNULL ((2)));
1336 # endif
1337 _GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen));
1338 # endif
1339 # if 1
1340 _GL_CXXALIASWARN (strerror_r);
1341 # endif
1342 #elif defined GNULIB_POSIXCHECK
1343 # undef strerror_r
1344 # if HAVE_RAW_DECL_STRERROR_R
1345 _GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - "
1346  "use gnulib module strerror_r-posix for portability");
1347 # endif
1348 #endif
1349 
1350 #if 0
1351 # if 0
1352 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1353 # define strsignal rpl_strsignal
1354 # endif
1355 _GL_FUNCDECL_RPL (strsignal, char *, (int __sig));
1356 _GL_CXXALIAS_RPL (strsignal, char *, (int __sig));
1357 # else
1358 # if ! 1
1359 _GL_FUNCDECL_SYS (strsignal, char *, (int __sig));
1360 # endif
1361 /* Need to cast, because on Cygwin 1.5.x systems, the return type is
1362  'const char *'. */
1363 _GL_CXXALIAS_SYS_CAST (strsignal, char *, (int __sig));
1364 # endif
1365 _GL_CXXALIASWARN (strsignal);
1366 #elif defined GNULIB_POSIXCHECK
1367 # undef strsignal
1368 # if HAVE_RAW_DECL_STRSIGNAL
1369 _GL_WARN_ON_USE (strsignal, "strsignal is unportable - "
1370  "use gnulib module strsignal for portability");
1371 # endif
1372 #endif
1373 
1374 #if 0
1375 # if !1
1376 _GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *)
1378  _GL_ARG_NONNULL ((1, 2)));
1379 # endif
1380 _GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *));
1381 _GL_CXXALIASWARN (strverscmp);
1382 #elif defined GNULIB_POSIXCHECK
1383 # undef strverscmp
1384 # if HAVE_RAW_DECL_STRVERSCMP
1385 _GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - "
1386  "use gnulib module strverscmp for portability");
1387 # endif
1388 #endif
1389 
1390 
1391 #endif /* _GL_STRING_H */
1392 #endif /* _GL_STRING_H */
1393 #endif
#define _GL_CXXALIAS_SYS_CAST2(func, rettype, parameters, rettype2, parameters2)
Definition: string.h:301
#define _GL_ATTRIBUTE_PURE
Definition: string.h:61
#define _GL_CXXALIASWARN(func)
Definition: string.h:329
#define _GL_CXXALIAS_SYS(func, rettype, parameters)
Definition: string.h:247
#define _GL_CXXALIAS_SYS_CAST(func, rettype, parameters)
Definition: string.h:270
#define _GL_CXXALIAS_RPL(func, rettype, parameters)
Definition: string.h:182
#define _GL_ARG_NONNULL(params)
Definition: string.h:371
#define _GL_CXXALIASWARN1(func, rettype, parameters_and_attributes)
Definition: string.h:357
#define _GL_EXTERN_C
Definition: string.h:148
#define _GL_FUNCDECL_RPL(func, rettype, parameters_and_attributes)
Definition: string.h:158
#define _GL_WARN_ON_USE(function, message)
Definition: string.h:387
#define _GL_FUNCDECL_SYS(func, rettype, parameters_and_attributes)
Definition: string.h:170
#define restrict
Definition: config.h:1902
char * strerror(int)