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