Add AT_HWCAP2 as a new auxv_t a_type to elf.h.
[glibc.git] / string / strings.h
blob97cddc8dd05cdcaadcb527cea5a657bce42ed5c8
1 /* Copyright (C) 1991,1992,1996,1997,1999,2000,2001,2009,2010,2012
2 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
19 #ifndef _STRINGS_H
20 #define _STRINGS_H 1
22 /* We don't need and should not read this file if <string.h> was already
23 read. The one exception being that if __USE_BSD isn't defined, then
24 these aren't defined in string.h, so we need to define them here. */
25 #if !defined _STRING_H || !defined __USE_BSD
27 # include <features.h>
28 # define __need_size_t
29 # include <stddef.h>
31 /* Tell the caller that we provide correct C++ prototypes. */
32 # if defined __cplusplus && __GNUC_PREREQ (4, 4)
33 # define __CORRECT_ISO_CPP_STRINGS_H_PROTO
34 # endif
36 __BEGIN_DECLS
38 # if defined __USE_MISC || !defined __USE_XOPEN2K8
39 /* Compare N bytes of S1 and S2 (same as memcmp). */
40 extern int bcmp (const void *__s1, const void *__s2, size_t __n)
41 __THROW __attribute_pure__;
43 /* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
44 extern void bcopy (const void *__src, void *__dest, size_t __n) __THROW;
46 /* Set N bytes of S to 0. */
47 extern void bzero (void *__s, size_t __n) __THROW;
49 /* Find the first occurrence of C in S (same as strchr). */
50 # ifdef __CORRECT_ISO_CPP_STRINGS_H_PROTO
51 extern "C++"
53 extern char *index (char *__s, int __c)
54 __THROW __asm ("index") __attribute_pure__ __nonnull ((1));
55 extern const char *index (const char *__s, int __c)
56 __THROW __asm ("index") __attribute_pure__ __nonnull ((1));
58 # if defined __OPTIMIZE__ && !defined __CORRECT_ISO_CPP_STRING_H_PROTO
59 __extern_always_inline char *
60 index (char *__s, int __c) __THROW
62 return __builtin_index (__s, __c);
65 __extern_always_inline const char *
66 index (const char *__s, int __c) __THROW
68 return __builtin_index (__s, __c);
70 # endif
72 # else
73 extern char *index (const char *__s, int __c)
74 __THROW __attribute_pure__ __nonnull ((1));
75 # endif
77 /* Find the last occurrence of C in S (same as strrchr). */
78 # ifdef __CORRECT_ISO_CPP_STRINGS_H_PROTO
79 extern "C++"
81 extern char *rindex (char *__s, int __c)
82 __THROW __asm ("rindex") __attribute_pure__ __nonnull ((1));
83 extern const char *rindex (const char *__s, int __c)
84 __THROW __asm ("rindex") __attribute_pure__ __nonnull ((1));
86 # if defined __OPTIMIZE__ && !defined __CORRECT_ISO_CPP_STRING_H_PROTO
87 __extern_always_inline char *
88 rindex (char *__s, int __c) __THROW
90 return __builtin_rindex (__s, __c);
93 __extern_always_inline const char *
94 rindex (const char *__s, int __c) __THROW
96 return __builtin_rindex (__s, __c);
98 # endif
100 # else
101 extern char *rindex (const char *__s, int __c)
102 __THROW __attribute_pure__ __nonnull ((1));
103 # endif
104 # endif
106 #if defined __USE_MISC || !defined __USE_XOPEN2K8 || defined __USE_XOPEN2K8XSI
107 /* Return the position of the first bit set in I, or 0 if none are set.
108 The least-significant bit is position 1, the most-significant 32. */
109 extern int ffs (int __i) __THROW __attribute__ ((const));
110 #endif
112 /* Compare S1 and S2, ignoring case. */
113 extern int strcasecmp (const char *__s1, const char *__s2)
114 __THROW __attribute_pure__;
116 /* Compare no more than N chars of S1 and S2, ignoring case. */
117 extern int strncasecmp (const char *__s1, const char *__s2, size_t __n)
118 __THROW __attribute_pure__;
120 #ifdef __USE_XOPEN2K8
121 /* The following functions are equivalent to the both above but they
122 take the locale they use for the collation as an extra argument.
123 This is not standardsized but something like will come. */
124 # include <xlocale.h>
126 /* Again versions of a few functions which use the given locale instead
127 of the global one. */
128 extern int strcasecmp_l (const char *__s1, const char *__s2, __locale_t __loc)
129 __THROW __attribute_pure__ __nonnull ((1, 2, 3));
131 extern int strncasecmp_l (const char *__s1, const char *__s2,
132 size_t __n, __locale_t __loc)
133 __THROW __attribute_pure__ __nonnull ((1, 2, 4));
134 #endif
136 __END_DECLS
138 #endif /* string.h */
140 #endif /* strings.h */