~ubuntu-branches/ubuntu/trusty/gnutls26/trusty

« back to all changes in this revision

Viewing changes to gl/string.in.h

  • Committer: Package Import Robot
  • Author(s): Andreas Metzler
  • Date: 2011-10-01 15:28:13 UTC
  • mfrom: (12.1.20 sid)
  • Revision ID: package-import@ubuntu.com-20111001152813-yygm1c4cxonfxhzy
* New upstream version.
  + Allow CA importing of 0 certificates to succeed. Closes: #640639
* Add libp11-kit-dev to libgnutls-dev dependencies. (see #643811)
* [20_guiledocstring.diff] guile: Fix docstring extraction with CPP 4.5+.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* A GNU-like <string.h>.
2
2
 
3
 
   Copyright (C) 1995-1996, 2001-2010 Free Software Foundation, Inc.
 
3
   Copyright (C) 1995-1996, 2001-2011 Free Software Foundation, Inc.
4
4
 
5
5
   This program is free software; you can redistribute it and/or modify
6
6
   it under the terms of the GNU General Public License as published by
21
21
#if __GNUC__ >= 3
22
22
@PRAGMA_SYSTEM_HEADER@
23
23
#endif
 
24
@PRAGMA_COLUMNS@
24
25
 
25
26
/* The include_next requires a split double-inclusion guard.  */
26
27
#@INCLUDE_NEXT@ @NEXT_STRING_H@
36
37
# include <wchar.h>
37
38
#endif
38
39
 
39
 
#ifndef __attribute__
40
 
/* This feature is available in gcc versions 2.5 and later.  */
41
 
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
42
 
#  define __attribute__(Spec) /* empty */
43
 
# endif
44
 
/* The attribute __pure__ was added in gcc 2.96.  */
45
 
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
46
 
#  define __pure__ /* empty */
47
 
# endif
 
40
/* The __attribute__ feature is available in gcc versions 2.5 and later.
 
41
   The attribute __pure__ was added in gcc 2.96.  */
 
42
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
 
43
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
 
44
#else
 
45
# define _GL_ATTRIBUTE_PURE /* empty */
48
46
#endif
49
47
 
 
48
/* NetBSD 5.0 declares strsignal in <unistd.h>, not in <string.h>.  */
 
49
/* But in any case avoid namespace pollution on glibc systems.  */
 
50
#if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \
 
51
    && ! defined __GLIBC__
 
52
# include <unistd.h>
 
53
#endif
50
54
 
51
55
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
52
56
 
62
66
#   define memchr rpl_memchr
63
67
#  endif
64
68
_GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n)
65
 
                                  __attribute__ ((__pure__))
 
69
                                  _GL_ATTRIBUTE_PURE
66
70
                                  _GL_ARG_NONNULL ((1)));
67
71
_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n));
68
72
# else
69
73
#  if ! @HAVE_MEMCHR@
70
74
_GL_FUNCDECL_SYS (memchr, void *, (void const *__s, int __c, size_t __n)
71
 
                                  __attribute__ ((__pure__))
 
75
                                  _GL_ATTRIBUTE_PURE
72
76
                                  _GL_ARG_NONNULL ((1)));
73
77
#  endif
74
78
  /* On some systems, this function is defined as an overloaded function:
78
82
                        void *, (void const *__s, int __c, size_t __n),
79
83
                        void const *, (void const *__s, int __c, size_t __n));
80
84
# endif
81
 
# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
 
85
# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
82
86
     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
83
87
_GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n));
84
88
_GL_CXXALIASWARN1 (memchr, void const *,
102
106
_GL_FUNCDECL_RPL (memmem, void *,
103
107
                  (void const *__haystack, size_t __haystack_len,
104
108
                   void const *__needle, size_t __needle_len)
105
 
                  __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 3)));
 
109
                  _GL_ATTRIBUTE_PURE
 
110
                  _GL_ARG_NONNULL ((1, 3)));
106
111
_GL_CXXALIAS_RPL (memmem, void *,
107
112
                  (void const *__haystack, size_t __haystack_len,
108
113
                   void const *__needle, size_t __needle_len));
111
116
_GL_FUNCDECL_SYS (memmem, void *,
112
117
                  (void const *__haystack, size_t __haystack_len,
113
118
                   void const *__needle, size_t __needle_len)
114
 
                  __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 3)));
 
119
                  _GL_ATTRIBUTE_PURE
 
120
                  _GL_ARG_NONNULL ((1, 3)));
115
121
#  endif
116
122
_GL_CXXALIAS_SYS (memmem, void *,
117
123
                  (void const *__haystack, size_t __haystack_len,
152
158
#if @GNULIB_MEMRCHR@
153
159
# if ! @HAVE_DECL_MEMRCHR@
154
160
_GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t)
155
 
                                   __attribute__ ((__pure__))
 
161
                                   _GL_ATTRIBUTE_PURE
156
162
                                   _GL_ARG_NONNULL ((1)));
157
163
# endif
158
164
  /* On some systems, this function is defined as an overloaded function:
161
167
_GL_CXXALIAS_SYS_CAST2 (memrchr,
162
168
                        void *, (void const *, int, size_t),
163
169
                        void const *, (void const *, int, size_t));
164
 
# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
 
170
# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
165
171
     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
166
172
_GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t));
167
173
_GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t));
182
188
#if @GNULIB_RAWMEMCHR@
183
189
# if ! @HAVE_RAWMEMCHR@
184
190
_GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in)
185
 
                                     __attribute__ ((__pure__))
 
191
                                     _GL_ATTRIBUTE_PURE
186
192
                                     _GL_ARG_NONNULL ((1)));
187
193
# endif
188
194
  /* On some systems, this function is defined as an overloaded function:
191
197
_GL_CXXALIAS_SYS_CAST2 (rawmemchr,
192
198
                        void *, (void const *__s, int __c_in),
193
199
                        void const *, (void const *__s, int __c_in));
194
 
# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
 
200
# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
195
201
     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
196
202
_GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in));
197
203
_GL_CXXALIASWARN1 (rawmemchr, void const *, (void const *__s, int __c_in));
229
235
#if @GNULIB_STPNCPY@
230
236
# if @REPLACE_STPNCPY@
231
237
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
238
#   undef stpncpy
232
239
#   define stpncpy rpl_stpncpy
233
240
#  endif
234
241
_GL_FUNCDECL_RPL (stpncpy, char *,
272
279
#if @GNULIB_STRCHRNUL@
273
280
# if ! @HAVE_STRCHRNUL@
274
281
_GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in)
275
 
                                     __attribute__ ((__pure__))
 
282
                                     _GL_ATTRIBUTE_PURE
276
283
                                     _GL_ARG_NONNULL ((1)));
277
284
# endif
278
285
  /* On some systems, this function is defined as an overloaded function:
281
288
_GL_CXXALIAS_SYS_CAST2 (strchrnul,
282
289
                        char *, (char const *__s, int __c_in),
283
290
                        char const *, (char const *__s, int __c_in));
284
 
# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
 
291
# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
285
292
     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
286
293
_GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in));
287
294
_GL_CXXALIASWARN1 (strchrnul, char const *, (char const *__s, int __c_in));
306
313
_GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
307
314
_GL_CXXALIAS_RPL (strdup, char *, (char const *__s));
308
315
# else
 
316
#  if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
 
317
    /* strdup exists as a function and as a macro.  Get rid of the macro.  */
 
318
#   undef strdup
 
319
#  endif
309
320
#  if !(@HAVE_DECL_STRDUP@ || defined strdup)
310
321
_GL_FUNCDECL_SYS (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
311
322
#  endif
378
389
#   define strnlen rpl_strnlen
379
390
#  endif
380
391
_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__string, size_t __maxlen)
381
 
                                   __attribute__ ((__pure__))
 
392
                                   _GL_ATTRIBUTE_PURE
382
393
                                   _GL_ARG_NONNULL ((1)));
383
394
_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__string, size_t __maxlen));
384
395
# else
385
396
#  if ! @HAVE_DECL_STRNLEN@
386
397
_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__string, size_t __maxlen)
387
 
                                   __attribute__ ((__pure__))
 
398
                                   _GL_ATTRIBUTE_PURE
388
399
                                   _GL_ARG_NONNULL ((1)));
389
400
#  endif
390
401
_GL_CXXALIAS_SYS (strnlen, size_t, (char const *__string, size_t __maxlen));
414
425
#if @GNULIB_STRPBRK@
415
426
# if ! @HAVE_STRPBRK@
416
427
_GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept)
417
 
                                   __attribute__ ((__pure__))
 
428
                                   _GL_ATTRIBUTE_PURE
418
429
                                   _GL_ARG_NONNULL ((1, 2)));
419
430
# endif
420
431
  /* On some systems, this function is defined as an overloaded function:
423
434
_GL_CXXALIAS_SYS_CAST2 (strpbrk,
424
435
                        char *, (char const *__s, char const *__accept),
425
436
                        const char *, (char const *__s, char const *__accept));
426
 
# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
 
437
# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
427
438
     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
428
439
_GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept));
429
440
_GL_CXXALIASWARN1 (strpbrk, char const *,
514
525
#   define strstr rpl_strstr
515
526
#  endif
516
527
_GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle)
517
 
                                  __attribute__ ((__pure__))
 
528
                                  _GL_ATTRIBUTE_PURE
518
529
                                  _GL_ARG_NONNULL ((1, 2)));
519
530
_GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle));
520
531
# else
525
536
                        char *, (const char *haystack, const char *needle),
526
537
                        const char *, (const char *haystack, const char *needle));
527
538
# endif
528
 
# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
 
539
# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
529
540
     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
530
541
_GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle));
531
542
_GL_CXXALIASWARN1 (strstr, const char *,
556
567
#  endif
557
568
_GL_FUNCDECL_RPL (strcasestr, char *,
558
569
                  (const char *haystack, const char *needle)
559
 
                  __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2)));
 
570
                  _GL_ATTRIBUTE_PURE
 
571
                  _GL_ARG_NONNULL ((1, 2)));
560
572
_GL_CXXALIAS_RPL (strcasestr, char *,
561
573
                  (const char *haystack, const char *needle));
562
574
# else
563
575
#  if ! @HAVE_STRCASESTR@
564
576
_GL_FUNCDECL_SYS (strcasestr, char *,
565
577
                  (const char *haystack, const char *needle)
566
 
                  __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2)));
 
578
                  _GL_ATTRIBUTE_PURE
 
579
                  _GL_ARG_NONNULL ((1, 2)));
567
580
#  endif
568
581
  /* On some systems, this function is defined as an overloaded function:
569
582
       extern "C++" { const char * strcasestr (const char *, const char *); }
572
585
                        char *, (const char *haystack, const char *needle),
573
586
                        const char *, (const char *haystack, const char *needle));
574
587
# endif
575
 
# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
 
588
# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
576
589
     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
577
590
_GL_CXXALIASWARN1 (strcasestr, char *, (char *haystack, const char *needle));
578
591
_GL_CXXALIASWARN1 (strcasestr, const char *,
764
777
#if @GNULIB_MBSPCASECMP@
765
778
/* Compare the initial segment of the character string STRING consisting of
766
779
   at most mbslen (PREFIX) characters with the character string PREFIX,
767
 
   ignoring case, returning less than, equal to or greater than zero if this
768
 
   initial segment is lexicographically less than, equal to or greater than
769
 
   PREFIX.
770
 
   Note: This function may, in multibyte locales, return 0 if STRING is of
771
 
   smaller length than PREFIX!
 
780
   ignoring case.  If the two match, return a pointer to the first byte
 
781
   after this prefix in STRING.  Otherwise, return NULL.
 
782
   Note: This function may, in multibyte locales, return non-NULL if STRING
 
783
   is of smaller length than PREFIX!
772
784
   Unlike strncasecmp(), this function works correctly in multibyte
773
785
   locales.  */
774
786
_GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
885
897
                 "use gnulib module strerror to guarantee non-NULL result");
886
898
#endif
887
899
 
 
900
/* Map any int, typically from errno, into an error message.  Multithread-safe.
 
901
   Uses the POSIX declaration, not the glibc declaration.  */
 
902
#if @GNULIB_STRERROR_R@
 
903
# if @REPLACE_STRERROR_R@
 
904
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
905
#   undef strerror_r
 
906
#   define strerror_r rpl_strerror_r
 
907
#  endif
 
908
_GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen)
 
909
                                   _GL_ARG_NONNULL ((2)));
 
910
_GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen));
 
911
# else
 
912
#  if !@HAVE_DECL_STRERROR_R@
 
913
_GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)
 
914
                                   _GL_ARG_NONNULL ((2)));
 
915
#  endif
 
916
_GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen));
 
917
# endif
 
918
# if @HAVE_DECL_STRERROR_R@
 
919
_GL_CXXALIASWARN (strerror_r);
 
920
# endif
 
921
#elif defined GNULIB_POSIXCHECK
 
922
# undef strerror_r
 
923
# if HAVE_RAW_DECL_STRERROR_R
 
924
_GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - "
 
925
                 "use gnulib module strerror_r-posix for portability");
 
926
# endif
 
927
#endif
 
928
 
888
929
#if @GNULIB_STRSIGNAL@
889
930
# if @REPLACE_STRSIGNAL@
890
931
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)