lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | /* Copyright (C) 1999-2015 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 | /* <bits/string.h> and <bits/string2.h> declare some extern inline |
| 19 | functions. These functions are declared additionally here if |
| 20 | inlining is not possible. */ |
| 21 | |
| 22 | #undef __USE_STRING_INLINES |
| 23 | #define __USE_STRING_INLINES |
| 24 | #define _FORCE_INLINES |
| 25 | #define __STRING_INLINE /* empty */ |
| 26 | #define __NO_INLINE__ |
| 27 | |
| 28 | #include <string.h> |
| 29 | #undef index |
| 30 | #undef rindex |
| 31 | |
| 32 | #undef __NO_INLINE__ |
| 33 | #include <bits/string.h> |
| 34 | #include <bits/string2.h> |
| 35 | |
| 36 | /* Functions which are inlines in i486 but not i386. */ |
| 37 | void * |
| 38 | __memcpy_by2 (void *dest, const void *src, size_t n) |
| 39 | { |
| 40 | return memcpy (dest, src, n); |
| 41 | } |
| 42 | strong_alias (__memcpy_by2, __memcpy_by4) |
| 43 | strong_alias (__memcpy_by2, __memcpy_g) |
| 44 | strong_alias (__memcpy_by2, __memcpy_g_internal) |
| 45 | |
| 46 | void * |
| 47 | __memset_ccn_by2 (void *s, unsigned int c, size_t n) |
| 48 | { |
| 49 | return memset (s, c & 0xff, n); |
| 50 | } |
| 51 | strong_alias (__memset_ccn_by2, __memset_ccn_by4) |
| 52 | |
| 53 | void * |
| 54 | __memset_gcn_by2 (void *s, int c, size_t n) |
| 55 | { |
| 56 | return memset (s, c, n); |
| 57 | } |
| 58 | strong_alias (__memset_gcn_by2, __memset_gcn_by4) |
| 59 | |
| 60 | size_t |
| 61 | __strlen_g (const char *s) |
| 62 | { |
| 63 | return strlen (s); |
| 64 | } |
| 65 | |
| 66 | char * |
| 67 | __strcpy_g (char *d, const char *s) |
| 68 | { |
| 69 | return strcpy (d, s); |
| 70 | } |
| 71 | |
| 72 | char * |
| 73 | __mempcpy_by2 (char *d, const char *s, size_t n) |
| 74 | { |
| 75 | return mempcpy (d, s, n); |
| 76 | } |
| 77 | strong_alias (__mempcpy_by2, __mempcpy_by4) |
| 78 | strong_alias (__mempcpy_by2, __mempcpy_byn) |
| 79 | |
| 80 | char * |
| 81 | __stpcpy_g (char *d, const char *s) |
| 82 | { |
| 83 | return stpcpy (d, s); |
| 84 | } |
| 85 | |
| 86 | char * |
| 87 | __strncpy_by2 (char *d, const char s[], size_t srclen, size_t n) |
| 88 | { |
| 89 | return strncpy (d, s, n); |
| 90 | } |
| 91 | strong_alias (__strncpy_by2, __strncpy_by4) |
| 92 | strong_alias (__strncpy_by2, __strncpy_byn) |
| 93 | |
| 94 | char * |
| 95 | __strncpy_gg (char *d, const char *s, size_t n) |
| 96 | { |
| 97 | return strncpy (d, s, n); |
| 98 | } |
| 99 | |
| 100 | char * |
| 101 | __strcat_c (char *d, const char s[], size_t srclen) |
| 102 | { |
| 103 | return strcat (d, s); |
| 104 | } |
| 105 | |
| 106 | char * |
| 107 | __strcat_g (char *d, const char *s) |
| 108 | { |
| 109 | return strcat (d, s); |
| 110 | } |
| 111 | |
| 112 | char * |
| 113 | __strncat_g (char *d, const char s[], size_t n) |
| 114 | { |
| 115 | return strncat (d, s, n); |
| 116 | } |
| 117 | |
| 118 | int |
| 119 | __strcmp_gg (const char *s1, const char *s2) |
| 120 | { |
| 121 | return strcmp (s1, s2); |
| 122 | } |
| 123 | |
| 124 | int |
| 125 | __strncmp_g (const char *s1, const char *s2, size_t n) |
| 126 | { |
| 127 | return strncmp (s1, s2, n); |
| 128 | } |
| 129 | |
| 130 | char * |
| 131 | __strrchr_c (const char *s, int c) |
| 132 | { |
| 133 | return strrchr (s, c >> 8); |
| 134 | } |
| 135 | |
| 136 | char * |
| 137 | __strrchr_g (const char *s, int c) |
| 138 | { |
| 139 | return strrchr (s, c); |
| 140 | } |
| 141 | |
| 142 | size_t |
| 143 | __strcspn_cg (const char *s, const char reject[], size_t reject_len) |
| 144 | { |
| 145 | return strcspn (s, reject); |
| 146 | } |
| 147 | |
| 148 | size_t |
| 149 | __strcspn_g (const char *s, const char *reject) |
| 150 | { |
| 151 | return strcspn (s, reject); |
| 152 | } |
| 153 | |
| 154 | size_t |
| 155 | __strspn_cg (const char *s, const char accept[], size_t accept_len) |
| 156 | { |
| 157 | return strspn (s, accept); |
| 158 | } |
| 159 | |
| 160 | size_t |
| 161 | __strspn_g (const char *s, const char *accept) |
| 162 | { |
| 163 | return strspn (s, accept); |
| 164 | } |
| 165 | |
| 166 | char * |
| 167 | __strpbrk_cg (const char *s, const char accept[], size_t accept_len) |
| 168 | { |
| 169 | return strpbrk (s, accept); |
| 170 | } |
| 171 | |
| 172 | char * |
| 173 | __strpbrk_g (const char *s, const char *accept) |
| 174 | { |
| 175 | return strpbrk (s, accept); |
| 176 | } |
| 177 | |
| 178 | char * |
| 179 | __strstr_cg (const char *haystack, const char needle[], size_t needle_len) |
| 180 | { |
| 181 | return strstr (haystack, needle); |
| 182 | } |
| 183 | |
| 184 | char * |
| 185 | __strstr_g (const char *haystack, const char needle[]) |
| 186 | { |
| 187 | return strstr (haystack, needle); |
| 188 | } |