~ubuntu-branches/ubuntu/quantal/gnutls26/quantal-security

« back to all changes in this revision

Viewing changes to lib/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
Tags: 2.12.11-1
* 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 Lesser General Public License as published by
16
16
   along with this program; if not, write to the Free Software Foundation,
17
17
   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
18
18
 
19
 
#ifndef _GL_STRING_H
 
19
#ifndef _@GUARD_PREFIX@_STRING_H
20
20
 
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@
27
28
 
28
 
#ifndef _GL_STRING_H
29
 
#define _GL_STRING_H
 
29
#ifndef _@GUARD_PREFIX@_STRING_H
 
30
#define _@GUARD_PREFIX@_STRING_H
30
31
 
31
32
/* NetBSD 5.0 mis-defines NULL.  */
32
33
#include <stddef.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
 
55
59
/* The definition of _GL_WARN_ON_USE is copied here.  */
56
60
 
57
61
 
 
62
/* Find the index of the least-significant set bit.  */
 
63
#if @GNULIB_FFSL@
 
64
# if !@HAVE_FFSL@
 
65
_GL_FUNCDECL_SYS (ffsl, int, (long int i));
 
66
# endif
 
67
_GL_CXXALIAS_SYS (ffsl, int, (long int i));
 
68
_GL_CXXALIASWARN (ffsl);
 
69
#elif defined GNULIB_POSIXCHECK
 
70
# undef ffsl
 
71
# if HAVE_RAW_DECL_FFSL
 
72
_GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module");
 
73
# endif
 
74
#endif
 
75
 
 
76
 
 
77
/* Find the index of the least-significant set bit.  */
 
78
#if @GNULIB_FFSLL@
 
79
# if !@HAVE_FFSLL@
 
80
_GL_FUNCDECL_SYS (ffsll, int, (long long int i));
 
81
# endif
 
82
_GL_CXXALIAS_SYS (ffsll, int, (long long int i));
 
83
_GL_CXXALIASWARN (ffsll);
 
84
#elif defined GNULIB_POSIXCHECK
 
85
# undef ffsll
 
86
# if HAVE_RAW_DECL_FFSLL
 
87
_GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module");
 
88
# endif
 
89
#endif
 
90
 
 
91
 
58
92
/* Return the first instance of C within N bytes of S, or NULL.  */
59
93
#if @GNULIB_MEMCHR@
60
94
# if @REPLACE_MEMCHR@
62
96
#   define memchr rpl_memchr
63
97
#  endif
64
98
_GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n)
65
 
                                  __attribute__ ((__pure__))
 
99
                                  _GL_ATTRIBUTE_PURE
66
100
                                  _GL_ARG_NONNULL ((1)));
67
101
_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n));
68
102
# else
69
103
#  if ! @HAVE_MEMCHR@
70
104
_GL_FUNCDECL_SYS (memchr, void *, (void const *__s, int __c, size_t __n)
71
 
                                  __attribute__ ((__pure__))
 
105
                                  _GL_ATTRIBUTE_PURE
72
106
                                  _GL_ARG_NONNULL ((1)));
73
107
#  endif
74
108
  /* On some systems, this function is defined as an overloaded function:
78
112
                        void *, (void const *__s, int __c, size_t __n),
79
113
                        void const *, (void const *__s, int __c, size_t __n));
80
114
# endif
81
 
# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
 
115
# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
82
116
     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
83
117
_GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n));
84
118
_GL_CXXALIASWARN1 (memchr, void const *,
102
136
_GL_FUNCDECL_RPL (memmem, void *,
103
137
                  (void const *__haystack, size_t __haystack_len,
104
138
                   void const *__needle, size_t __needle_len)
105
 
                  __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 3)));
 
139
                  _GL_ATTRIBUTE_PURE
 
140
                  _GL_ARG_NONNULL ((1, 3)));
106
141
_GL_CXXALIAS_RPL (memmem, void *,
107
142
                  (void const *__haystack, size_t __haystack_len,
108
143
                   void const *__needle, size_t __needle_len));
111
146
_GL_FUNCDECL_SYS (memmem, void *,
112
147
                  (void const *__haystack, size_t __haystack_len,
113
148
                   void const *__needle, size_t __needle_len)
114
 
                  __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 3)));
 
149
                  _GL_ATTRIBUTE_PURE
 
150
                  _GL_ARG_NONNULL ((1, 3)));
115
151
#  endif
116
152
_GL_CXXALIAS_SYS (memmem, void *,
117
153
                  (void const *__haystack, size_t __haystack_len,
152
188
#if @GNULIB_MEMRCHR@
153
189
# if ! @HAVE_DECL_MEMRCHR@
154
190
_GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t)
155
 
                                   __attribute__ ((__pure__))
 
191
                                   _GL_ATTRIBUTE_PURE
156
192
                                   _GL_ARG_NONNULL ((1)));
157
193
# endif
158
194
  /* On some systems, this function is defined as an overloaded function:
161
197
_GL_CXXALIAS_SYS_CAST2 (memrchr,
162
198
                        void *, (void const *, int, size_t),
163
199
                        void const *, (void const *, int, size_t));
164
 
# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
 
200
# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
165
201
     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
166
202
_GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t));
167
203
_GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t));
182
218
#if @GNULIB_RAWMEMCHR@
183
219
# if ! @HAVE_RAWMEMCHR@
184
220
_GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in)
185
 
                                     __attribute__ ((__pure__))
 
221
                                     _GL_ATTRIBUTE_PURE
186
222
                                     _GL_ARG_NONNULL ((1)));
187
223
# endif
188
224
  /* On some systems, this function is defined as an overloaded function:
191
227
_GL_CXXALIAS_SYS_CAST2 (rawmemchr,
192
228
                        void *, (void const *__s, int __c_in),
193
229
                        void const *, (void const *__s, int __c_in));
194
 
# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
 
230
# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
195
231
     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
196
232
_GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in));
197
233
_GL_CXXALIASWARN1 (rawmemchr, void const *, (void const *__s, int __c_in));
229
265
#if @GNULIB_STPNCPY@
230
266
# if @REPLACE_STPNCPY@
231
267
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
268
#   undef stpncpy
232
269
#   define stpncpy rpl_stpncpy
233
270
#  endif
234
271
_GL_FUNCDECL_RPL (stpncpy, char *,
270
307
 
271
308
/* Find the first occurrence of C in S or the final NUL byte.  */
272
309
#if @GNULIB_STRCHRNUL@
273
 
# if ! @HAVE_STRCHRNUL@
 
310
# if @REPLACE_STRCHRNUL@
 
311
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
312
#   define strchrnul rpl_strchrnul
 
313
#  endif
 
314
_GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in)
 
315
                                     _GL_ATTRIBUTE_PURE
 
316
                                     _GL_ARG_NONNULL ((1)));
 
317
_GL_CXXALIAS_RPL (strchrnul, char *,
 
318
                  (const char *str, int ch));
 
319
# else
 
320
#  if ! @HAVE_STRCHRNUL@
274
321
_GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in)
275
 
                                     __attribute__ ((__pure__))
 
322
                                     _GL_ATTRIBUTE_PURE
276
323
                                     _GL_ARG_NONNULL ((1)));
277
 
# endif
 
324
#  endif
278
325
  /* On some systems, this function is defined as an overloaded function:
279
326
       extern "C++" { const char * std::strchrnul (const char *, int); }
280
327
       extern "C++" { char * std::strchrnul (char *, int); }  */
281
328
_GL_CXXALIAS_SYS_CAST2 (strchrnul,
282
329
                        char *, (char const *__s, int __c_in),
283
330
                        char const *, (char const *__s, int __c_in));
284
 
# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
 
331
# endif
 
332
# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
285
333
     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
286
334
_GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in));
287
335
_GL_CXXALIASWARN1 (strchrnul, char const *, (char const *__s, int __c_in));
306
354
_GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
307
355
_GL_CXXALIAS_RPL (strdup, char *, (char const *__s));
308
356
# else
 
357
#  if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
 
358
    /* strdup exists as a function and as a macro.  Get rid of the macro.  */
 
359
#   undef strdup
 
360
#  endif
309
361
#  if !(@HAVE_DECL_STRDUP@ || defined strdup)
310
362
_GL_FUNCDECL_SYS (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
311
363
#  endif
378
430
#   define strnlen rpl_strnlen
379
431
#  endif
380
432
_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__string, size_t __maxlen)
381
 
                                   __attribute__ ((__pure__))
 
433
                                   _GL_ATTRIBUTE_PURE
382
434
                                   _GL_ARG_NONNULL ((1)));
383
435
_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__string, size_t __maxlen));
384
436
# else
385
437
#  if ! @HAVE_DECL_STRNLEN@
386
438
_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__string, size_t __maxlen)
387
 
                                   __attribute__ ((__pure__))
 
439
                                   _GL_ATTRIBUTE_PURE
388
440
                                   _GL_ARG_NONNULL ((1)));
389
441
#  endif
390
442
_GL_CXXALIAS_SYS (strnlen, size_t, (char const *__string, size_t __maxlen));
414
466
#if @GNULIB_STRPBRK@
415
467
# if ! @HAVE_STRPBRK@
416
468
_GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept)
417
 
                                   __attribute__ ((__pure__))
 
469
                                   _GL_ATTRIBUTE_PURE
418
470
                                   _GL_ARG_NONNULL ((1, 2)));
419
471
# endif
420
472
  /* On some systems, this function is defined as an overloaded function:
423
475
_GL_CXXALIAS_SYS_CAST2 (strpbrk,
424
476
                        char *, (char const *__s, char const *__accept),
425
477
                        const char *, (char const *__s, char const *__accept));
426
 
# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
 
478
# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
427
479
     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
428
480
_GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept));
429
481
_GL_CXXALIASWARN1 (strpbrk, char const *,
514
566
#   define strstr rpl_strstr
515
567
#  endif
516
568
_GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle)
517
 
                                  __attribute__ ((__pure__))
 
569
                                  _GL_ATTRIBUTE_PURE
518
570
                                  _GL_ARG_NONNULL ((1, 2)));
519
571
_GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle));
520
572
# else
525
577
                        char *, (const char *haystack, const char *needle),
526
578
                        const char *, (const char *haystack, const char *needle));
527
579
# endif
528
 
# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
 
580
# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
529
581
     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
530
582
_GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle));
531
583
_GL_CXXALIASWARN1 (strstr, const char *,
556
608
#  endif
557
609
_GL_FUNCDECL_RPL (strcasestr, char *,
558
610
                  (const char *haystack, const char *needle)
559
 
                  __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2)));
 
611
                  _GL_ATTRIBUTE_PURE
 
612
                  _GL_ARG_NONNULL ((1, 2)));
560
613
_GL_CXXALIAS_RPL (strcasestr, char *,
561
614
                  (const char *haystack, const char *needle));
562
615
# else
563
616
#  if ! @HAVE_STRCASESTR@
564
617
_GL_FUNCDECL_SYS (strcasestr, char *,
565
618
                  (const char *haystack, const char *needle)
566
 
                  __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2)));
 
619
                  _GL_ATTRIBUTE_PURE
 
620
                  _GL_ARG_NONNULL ((1, 2)));
567
621
#  endif
568
622
  /* On some systems, this function is defined as an overloaded function:
569
623
       extern "C++" { const char * strcasestr (const char *, const char *); }
572
626
                        char *, (const char *haystack, const char *needle),
573
627
                        const char *, (const char *haystack, const char *needle));
574
628
# endif
575
 
# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
 
629
# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
576
630
     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
577
631
_GL_CXXALIASWARN1 (strcasestr, char *, (char *haystack, const char *needle));
578
632
_GL_CXXALIASWARN1 (strcasestr, const char *,
712
766
   and return a pointer to it.  Return NULL if C is not found in STRING.
713
767
   Unlike strrchr(), this function works correctly in multibyte locales with
714
768
   encodings such as GB18030.  */
715
 
# if defined __hpux
 
769
# if defined __hpux || defined __INTERIX
716
770
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
717
 
#   define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */
 
771
#   define mbsrchr rpl_mbsrchr /* avoid collision with system function */
718
772
#  endif
719
773
_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c)
720
774
                                   _GL_ARG_NONNULL ((1)));
764
818
#if @GNULIB_MBSPCASECMP@
765
819
/* Compare the initial segment of the character string STRING consisting of
766
820
   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!
 
821
   ignoring case.  If the two match, return a pointer to the first byte
 
822
   after this prefix in STRING.  Otherwise, return NULL.
 
823
   Note: This function may, in multibyte locales, return non-NULL if STRING
 
824
   is of smaller length than PREFIX!
772
825
   Unlike strncasecmp(), this function works correctly in multibyte
773
826
   locales.  */
774
827
_GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
885
938
                 "use gnulib module strerror to guarantee non-NULL result");
886
939
#endif
887
940
 
 
941
/* Map any int, typically from errno, into an error message.  Multithread-safe.
 
942
   Uses the POSIX declaration, not the glibc declaration.  */
 
943
#if @GNULIB_STRERROR_R@
 
944
# if @REPLACE_STRERROR_R@
 
945
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
946
#   undef strerror_r
 
947
#   define strerror_r rpl_strerror_r
 
948
#  endif
 
949
_GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen)
 
950
                                   _GL_ARG_NONNULL ((2)));
 
951
_GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen));
 
952
# else
 
953
#  if !@HAVE_DECL_STRERROR_R@
 
954
_GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)
 
955
                                   _GL_ARG_NONNULL ((2)));
 
956
#  endif
 
957
_GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen));
 
958
# endif
 
959
# if @HAVE_DECL_STRERROR_R@
 
960
_GL_CXXALIASWARN (strerror_r);
 
961
# endif
 
962
#elif defined GNULIB_POSIXCHECK
 
963
# undef strerror_r
 
964
# if HAVE_RAW_DECL_STRERROR_R
 
965
_GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - "
 
966
                 "use gnulib module strerror_r-posix for portability");
 
967
# endif
 
968
#endif
 
969
 
888
970
#if @GNULIB_STRSIGNAL@
889
971
# if @REPLACE_STRSIGNAL@
890
972
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
925
1007
#endif
926
1008
 
927
1009
 
928
 
#endif /* _GL_STRING_H */
929
 
#endif /* _GL_STRING_H */
 
1010
#endif /* _@GUARD_PREFIX@_STRING_H */
 
1011
#endif /* _@GUARD_PREFIX@_STRING_H */