modernc.org/cc@v1.0.1/v2/headers/linux_386/usr/include/strings.h (about) 1 /* Copyright (C) 1991-2018 Free Software Foundation, Inc. 2 This file is part of the GNU C Library. 3 4 The GNU C Library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 9 The GNU C Library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General Public 15 License along with the GNU C Library; if not, see 16 <http://www.gnu.org/licenses/>. */ 17 18 #ifndef _STRINGS_H 19 #define _STRINGS_H 1 20 21 #include <features.h> 22 #define __need_size_t 23 #include <stddef.h> 24 25 /* Tell the caller that we provide correct C++ prototypes. */ 26 #if defined __cplusplus && __GNUC_PREREQ (4, 4) 27 # define __CORRECT_ISO_CPP_STRINGS_H_PROTO 28 #endif 29 30 __BEGIN_DECLS 31 #if defined __USE_MISC || !defined __USE_XOPEN2K8 32 /* Compare N bytes of S1 and S2 (same as memcmp). */ 33 extern int bcmp(const void *__s1, const void *__s2, size_t __n) 34 __THROW __attribute_pure__ __nonnull((1, 2)); 35 36 /* Copy N bytes of SRC to DEST (like memmove, but args reversed). */ 37 extern void bcopy(const void *__src, void *__dest, size_t __n) 38 __THROW __nonnull((1, 2)); 39 40 /* Set N bytes of S to 0. */ 41 extern void bzero(void *__s, size_t __n) 42 __THROW __nonnull((1)); 43 44 /* Find the first occurrence of C in S (same as strchr). */ 45 # ifdef __CORRECT_ISO_CPP_STRINGS_H_PROTO 46 extern "C++" { 47 extern char *index(char *__s, int __c) 48 __THROW __asm("index") __attribute_pure__ __nonnull((1)); 49 extern const char *index(const char *__s, int __c) 50 __THROW __asm("index") __attribute_pure__ __nonnull((1)); 51 52 # if defined __OPTIMIZE__ 53 __extern_always_inline char *index(char *__s, int __c) __THROW 54 { 55 return __builtin_index(__s, __c); 56 } __extern_always_inline const char *index(const char *__s, int __c) __THROW { 57 return __builtin_index(__s, __c); 58 } 59 # endif 60 } 61 # else 62 extern char *index(const char *__s, int __c) 63 __THROW __attribute_pure__ __nonnull((1)); 64 # endif 65 66 /* Find the last occurrence of C in S (same as strrchr). */ 67 # ifdef __CORRECT_ISO_CPP_STRINGS_H_PROTO 68 extern "C++" { 69 extern char *rindex(char *__s, int __c) 70 __THROW __asm("rindex") __attribute_pure__ __nonnull((1)); 71 extern const char *rindex(const char *__s, int __c) 72 __THROW __asm("rindex") __attribute_pure__ __nonnull((1)); 73 74 # if defined __OPTIMIZE__ 75 __extern_always_inline char *rindex(char *__s, int __c) __THROW 76 { 77 return __builtin_rindex(__s, __c); 78 } __extern_always_inline const char *rindex(const char *__s, int __c) __THROW { 79 return __builtin_rindex(__s, __c); 80 } 81 # endif 82 } 83 # else 84 extern char *rindex(const char *__s, int __c) 85 __THROW __attribute_pure__ __nonnull((1)); 86 # endif 87 #endif 88 89 #if defined __USE_MISC || !defined __USE_XOPEN2K8 || defined __USE_XOPEN2K8XSI 90 /* Return the position of the first bit set in I, or 0 if none are set. 91 The least-significant bit is position 1, the most-significant 32. */ 92 extern int ffs(int __i) 93 __THROW __attribute_const__; 94 #endif 95 96 /* The following two functions are non-standard but necessary for non-32 bit 97 platforms. */ 98 # ifdef __USE_MISC 99 extern int ffsl(long int __l) 100 __THROW __attribute_const__; 101 __extension__ extern int ffsll(long long int __ll) 102 __THROW __attribute_const__; 103 # endif 104 105 /* Compare S1 and S2, ignoring case. */ 106 extern int strcasecmp(const char *__s1, const char *__s2) 107 __THROW __attribute_pure__ __nonnull((1, 2)); 108 109 /* Compare no more than N chars of S1 and S2, ignoring case. */ 110 extern int strncasecmp(const char *__s1, const char *__s2, size_t __n) 111 __THROW __attribute_pure__ __nonnull((1, 2)); 112 113 #ifdef __USE_XOPEN2K8 114 /* POSIX.1-2008 extended locale interface (see locale.h). */ 115 # include <bits/types/locale_t.h> 116 117 /* Compare S1 and S2, ignoring case, using collation rules from LOC. */ 118 extern int strcasecmp_l(const char *__s1, const char *__s2, locale_t __loc) 119 __THROW __attribute_pure__ __nonnull((1, 2, 3)); 120 121 /* Compare no more than N chars of S1 and S2, ignoring case, using 122 collation rules from LOC. */ 123 extern int strncasecmp_l(const char *__s1, const char *__s2, size_t __n, locale_t __loc) 124 __THROW __attribute_pure__ __nonnull((1, 2, 4)); 125 #endif 126 127 __END_DECLS 128 #if __GNUC_PREREQ (3,4) && __USE_FORTIFY_LEVEL > 0 \ 129 && defined __fortify_function 130 /* Functions with security checks. */ 131 # if defined __USE_MISC || !defined __USE_XOPEN2K8 132 # include <bits/strings_fortified.h> 133 # endif 134 #endif 135 #endif /* strings.h */