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