diff options
| author | q66 | 2023-12-15 23:48:58 +0100 |
|---|---|---|
| committer | q66 | 2023-12-15 23:50:43 +0100 |
| commit | a018052d410126f94c2602b208b099839d333b05 (patch) | |
| tree | 6fb36635689a4568f384e1cc7c2ae9f4e617ad58 /include/string.h | |
| parent | 95441d2647a149ffa6db4a81c0a19e96e3b56ba5 (diff) | |
Rename some macros to be more namespace-friendly
Diffstat (limited to 'include/string.h')
| -rw-r--r-- | include/string.h | 126 |
1 files changed, 63 insertions, 63 deletions
diff --git a/include/string.h b/include/string.h index a6965b2..eb6cc90 100644 --- a/include/string.h +++ b/include/string.h | |||
| @@ -39,20 +39,20 @@ extern "C" { | |||
| 39 | #undef strncat | 39 | #undef strncat |
| 40 | #undef strncpy | 40 | #undef strncpy |
| 41 | 41 | ||
| 42 | __access(write_only, 1, 3) | 42 | __fh_access(write_only, 1, 3) |
| 43 | __access(read_only, 2, 3) | 43 | __fh_access(read_only, 2, 3) |
| 44 | #if __has_builtin(__builtin_mempcpy) | 44 | #if __has_builtin(__builtin_mempcpy) |
| 45 | __diagnose_as_builtin(__builtin_memcpy, 1, 2, 3) | 45 | __diagnose_as_builtin(__builtin_memcpy, 1, 2, 3) |
| 46 | #endif | 46 | #endif |
| 47 | _FORTIFY_FN(memcpy) void *memcpy(void * _FORTIFY_POS0 __od, | 47 | _FORTIFY_FN(memcpy) void *memcpy(void * _FORTIFY_POS0 __od, |
| 48 | const void * _FORTIFY_POS0 __os, size_t __n) | 48 | const void * _FORTIFY_POS0 __os, size_t __n) |
| 49 | __error_if((__bos(__od, 0) < __n), "'memcpy' called with `n` bigger than the size of `d`.") | 49 | __error_if((__fh_bos(__od, 0) < __n), "'memcpy' called with `n` bigger than the size of `d`.") |
| 50 | { | 50 | { |
| 51 | #if __has_builtin(__builtin___memcpy_chk) && USE_NATIVE_CHK | 51 | #if __has_builtin(__builtin___memcpy_chk) && USE_NATIVE_CHK |
| 52 | return __builtin___memcpy_chk(__od, __os, __n, __bos(__od, 0)); | 52 | return __builtin___memcpy_chk(__od, __os, __n, __fh_bos(__od, 0)); |
| 53 | #else | 53 | #else |
| 54 | __fh_size_t __bd = __bos(__od, 0); | 54 | __fh_size_t __bd = __fh_bos(__od, 0); |
| 55 | __fh_size_t __bs = __bos(__os, 0); | 55 | __fh_size_t __bs = __fh_bos(__os, 0); |
| 56 | char *__d = (char *)__od; | 56 | char *__d = (char *)__od; |
| 57 | const char *__s = (const char *)__os; | 57 | const char *__s = (const char *)__os; |
| 58 | 58 | ||
| @@ -64,8 +64,8 @@ __error_if((__bos(__od, 0) < __n), "'memcpy' called with `n` bigger than the siz | |||
| 64 | #endif | 64 | #endif |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | __access(write_only, 1, 3) | 67 | __fh_access(write_only, 1, 3) |
| 68 | __access(read_only, 2, 3) | 68 | __fh_access(read_only, 2, 3) |
| 69 | #if __has_builtin(__builtin_memmove) | 69 | #if __has_builtin(__builtin_memmove) |
| 70 | __diagnose_as_builtin(__builtin_memmove, 1, 2, 3) | 70 | __diagnose_as_builtin(__builtin_memmove, 1, 2, 3) |
| 71 | #endif | 71 | #endif |
| @@ -73,10 +73,10 @@ _FORTIFY_FN(memmove) void *memmove(void * _FORTIFY_POS0 __d, | |||
| 73 | const void * _FORTIFY_POS0 __s, size_t __n) | 73 | const void * _FORTIFY_POS0 __s, size_t __n) |
| 74 | { | 74 | { |
| 75 | #if __has_builtin(__builtin___memmove_chk) && USE_NATIVE_CHK | 75 | #if __has_builtin(__builtin___memmove_chk) && USE_NATIVE_CHK |
| 76 | return __builtin___memmove_chk(__d, __s, __n, __bos(__d, 0)); | 76 | return __builtin___memmove_chk(__d, __s, __n, __fh_bos(__d, 0)); |
| 77 | #else | 77 | #else |
| 78 | __fh_size_t __bd = __bos(__d, 0); | 78 | __fh_size_t __bd = __fh_bos(__d, 0); |
| 79 | __fh_size_t __bs = __bos(__s, 0); | 79 | __fh_size_t __bs = __fh_bos(__s, 0); |
| 80 | 80 | ||
| 81 | if (__n > __bd || __n > __bs) | 81 | if (__n > __bd || __n > __bs) |
| 82 | __builtin_trap(); | 82 | __builtin_trap(); |
| @@ -84,7 +84,7 @@ _FORTIFY_FN(memmove) void *memmove(void * _FORTIFY_POS0 __d, | |||
| 84 | #endif | 84 | #endif |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | __access(write_only, 1, 3) | 87 | __fh_access(write_only, 1, 3) |
| 88 | #if __has_builtin(__builtin_memset) | 88 | #if __has_builtin(__builtin_memset) |
| 89 | __diagnose_as_builtin(__builtin_memset, 1, 2, 3) | 89 | __diagnose_as_builtin(__builtin_memset, 1, 2, 3) |
| 90 | #endif | 90 | #endif |
| @@ -92,9 +92,9 @@ _FORTIFY_FN(memset) void *memset(void * _FORTIFY_POS0 __d, int __c, size_t __n) | |||
| 92 | __warning_if(__c != 0 && __n == 0, "'memset' will set `0` bytes; did you invert the arguments?") | 92 | __warning_if(__c != 0 && __n == 0, "'memset' will set `0` bytes; did you invert the arguments?") |
| 93 | { | 93 | { |
| 94 | #if __has_builtin(__builtin___memset_chk) && USE_NATIVE_CHK | 94 | #if __has_builtin(__builtin___memset_chk) && USE_NATIVE_CHK |
| 95 | return __builtin___memset_chk(__d, __c, __n, __bos(__d, 0)); | 95 | return __builtin___memset_chk(__d, __c, __n, __fh_bos(__d, 0)); |
| 96 | #else | 96 | #else |
| 97 | __fh_size_t __b = __bos(__d, 0); | 97 | __fh_size_t __b = __fh_bos(__d, 0); |
| 98 | 98 | ||
| 99 | if (__n > __b) | 99 | if (__n > __b) |
| 100 | __builtin_trap(); | 100 | __builtin_trap(); |
| @@ -102,16 +102,16 @@ __warning_if(__c != 0 && __n == 0, "'memset' will set `0` bytes; did you invert | |||
| 102 | #endif | 102 | #endif |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | __access(read_only, 1, 3) | 105 | __fh_access(read_only, 1, 3) |
| 106 | #if __has_builtin(__builtin_memchr) | 106 | #if __has_builtin(__builtin_memchr) |
| 107 | __diagnose_as_builtin(__builtin_memchr, 1, 2, 3) | 107 | __diagnose_as_builtin(__builtin_memchr, 1, 2, 3) |
| 108 | #endif | 108 | #endif |
| 109 | _FORTIFY_FN(memchr) void *memchr(const void * _FORTIFY_POS0 __d, int __c, size_t __n) | 109 | _FORTIFY_FN(memchr) void *memchr(const void * _FORTIFY_POS0 __d, int __c, size_t __n) |
| 110 | { | 110 | { |
| 111 | #if __has_builtin(__builtin___memchr_chk) && USE_NATIVE_CHK | 111 | #if __has_builtin(__builtin___memchr_chk) && USE_NATIVE_CHK |
| 112 | return __builtin___memchr_chk(__d, __c, __n, __bos(__d, 0)); | 112 | return __builtin___memchr_chk(__d, __c, __n, __fh_bos(__d, 0)); |
| 113 | #else | 113 | #else |
| 114 | __fh_size_t __b = __bos(__d, 0); | 114 | __fh_size_t __b = __fh_bos(__d, 0); |
| 115 | 115 | ||
| 116 | if (__n > __b) | 116 | if (__n > __b) |
| 117 | __builtin_trap(); | 117 | __builtin_trap(); |
| @@ -119,13 +119,13 @@ _FORTIFY_FN(memchr) void *memchr(const void * _FORTIFY_POS0 __d, int __c, size_t | |||
| 119 | #endif | 119 | #endif |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | __access(read_only, 1, 2) | 122 | __fh_access(read_only, 1, 2) |
| 123 | _FORTIFY_FN(strchr) char *strchr(const char * _FORTIFY_POS0 __s, int __c) | 123 | _FORTIFY_FN(strchr) char *strchr(const char * _FORTIFY_POS0 __s, int __c) |
| 124 | { | 124 | { |
| 125 | #if __has_builtin(__builtin___strchr_chk) && USE_NATIVE_CHK | 125 | #if __has_builtin(__builtin___strchr_chk) && USE_NATIVE_CHK |
| 126 | return __builtin___strchr_chk(__s, __c, __bos(__s, 0)); | 126 | return __builtin___strchr_chk(__s, __c, __fh_bos(__s, 0)); |
| 127 | #else | 127 | #else |
| 128 | __fh_size_t __b = __bos(__s, 0); | 128 | __fh_size_t __b = __fh_bos(__s, 0); |
| 129 | 129 | ||
| 130 | char* __r = __builtin_strchr(__s, __c); | 130 | char* __r = __builtin_strchr(__s, __c); |
| 131 | if (__r - __s > __b) | 131 | if (__r - __s > __b) |
| @@ -134,13 +134,13 @@ _FORTIFY_FN(strchr) char *strchr(const char * _FORTIFY_POS0 __s, int __c) | |||
| 134 | #endif | 134 | #endif |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | __access(read_only, 1, 2) | 137 | __fh_access(read_only, 1, 2) |
| 138 | _FORTIFY_FN(strrchr) char *strrchr(const char * _FORTIFY_POS0 __s, int __c) | 138 | _FORTIFY_FN(strrchr) char *strrchr(const char * _FORTIFY_POS0 __s, int __c) |
| 139 | { | 139 | { |
| 140 | #if __has_builtin(__builtin___strrchr_chk) && USE_NATIVE_CHK | 140 | #if __has_builtin(__builtin___strrchr_chk) && USE_NATIVE_CHK |
| 141 | return __builtin___strrchr_chk(__s, __c, __bos(__s, 0)); | 141 | return __builtin___strrchr_chk(__s, __c, __fh_bos(__s, 0)); |
| 142 | #else | 142 | #else |
| 143 | __fh_size_t __b = __bos(__s, 0); | 143 | __fh_size_t __b = __fh_bos(__s, 0); |
| 144 | 144 | ||
| 145 | char* __r = __builtin_strrchr(__s, __c); | 145 | char* __r = __builtin_strrchr(__s, __c); |
| 146 | if (__r - __s > __b) | 146 | if (__r - __s > __b) |
| @@ -153,22 +153,22 @@ _FORTIFY_FN(strrchr) char *strrchr(const char * _FORTIFY_POS0 __s, int __c) | |||
| 153 | || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ | 153 | || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ |
| 154 | || defined(_BSD_SOURCE) | 154 | || defined(_BSD_SOURCE) |
| 155 | #undef stpcpy | 155 | #undef stpcpy |
| 156 | __access(write_only, 1) | 156 | __fh_access(write_only, 1) |
| 157 | __access(read_only, 2) | 157 | __fh_access(read_only, 2) |
| 158 | #if __has_builtin(__builtin_stpcpy) | 158 | #if __has_builtin(__builtin_stpcpy) |
| 159 | __diagnose_as_builtin(__builtin_stpcpy, 1, 2) | 159 | __diagnose_as_builtin(__builtin_stpcpy, 1, 2) |
| 160 | #endif | 160 | #endif |
| 161 | _FORTIFY_FN(stpcpy) char *stpcpy(char * _FORTIFY_POS0 __d, const char *__s) | 161 | _FORTIFY_FN(stpcpy) char *stpcpy(char * _FORTIFY_POS0 __d, const char *__s) |
| 162 | { | 162 | { |
| 163 | #if __has_builtin(__builtin___stpcpy_chk) && USE_NATIVE_CHK | 163 | #if __has_builtin(__builtin___stpcpy_chk) && USE_NATIVE_CHK |
| 164 | return __builtin___stpcpy_chk(__d, __s, __bos(__d, 0)); | 164 | return __builtin___stpcpy_chk(__d, __s, __fh_bos(__d, 0)); |
| 165 | #else | 165 | #else |
| 166 | __fh_size_t __n = strlen(__s) + 1; | 166 | __fh_size_t __n = strlen(__s) + 1; |
| 167 | 167 | ||
| 168 | if (__fh_overlap(__d, __s, __n)) | 168 | if (__fh_overlap(__d, __s, __n)) |
| 169 | __builtin_trap(); | 169 | __builtin_trap(); |
| 170 | 170 | ||
| 171 | __fh_size_t __b = __bos(__d, 0); | 171 | __fh_size_t __b = __fh_bos(__d, 0); |
| 172 | if (__n > __b) | 172 | if (__n > __b) |
| 173 | __builtin_trap(); | 173 | __builtin_trap(); |
| 174 | return __orig_stpcpy(__d, __s); | 174 | return __orig_stpcpy(__d, __s); |
| @@ -176,8 +176,8 @@ _FORTIFY_FN(stpcpy) char *stpcpy(char * _FORTIFY_POS0 __d, const char *__s) | |||
| 176 | } | 176 | } |
| 177 | 177 | ||
| 178 | #undef stpncpy | 178 | #undef stpncpy |
| 179 | __access(write_only, 1) | 179 | __fh_access(write_only, 1) |
| 180 | __access(read_only, 2, 3) | 180 | __fh_access(read_only, 2, 3) |
| 181 | #if __has_builtin(__builtin_stpncpy) | 181 | #if __has_builtin(__builtin_stpncpy) |
| 182 | __diagnose_as_builtin(__builtin_stpncpy, 1, 2, 3) | 182 | __diagnose_as_builtin(__builtin_stpncpy, 1, 2, 3) |
| 183 | #endif | 183 | #endif |
| @@ -185,12 +185,12 @@ _FORTIFY_FN(stpncpy) char *stpncpy(char * _FORTIFY_POS0 __d, const char *__s, | |||
| 185 | size_t __n) | 185 | size_t __n) |
| 186 | { | 186 | { |
| 187 | #if __has_builtin(__builtin___stpncpy_chk) && USE_NATIVE_CHK | 187 | #if __has_builtin(__builtin___stpncpy_chk) && USE_NATIVE_CHK |
| 188 | return __builtin___stpncpy_chk(__d, __s, __n, __bos(__d, 0)); | 188 | return __builtin___stpncpy_chk(__d, __s, __n, __fh_bos(__d, 0)); |
| 189 | #else | 189 | #else |
| 190 | if (__fh_overlap(__d, __s, __n)) | 190 | if (__fh_overlap(__d, __s, __n)) |
| 191 | __builtin_trap(); | 191 | __builtin_trap(); |
| 192 | 192 | ||
| 193 | __fh_size_t __b = __bos(__d, 0); | 193 | __fh_size_t __b = __fh_bos(__d, 0); |
| 194 | if (__n > __b && strlen(__s) + 1 > __b) | 194 | if (__n > __b && strlen(__s) + 1 > __b) |
| 195 | __builtin_trap(); | 195 | __builtin_trap(); |
| 196 | return __orig_stpncpy(__d, __s, __n); | 196 | return __orig_stpncpy(__d, __s, __n); |
| @@ -198,17 +198,17 @@ _FORTIFY_FN(stpncpy) char *stpncpy(char * _FORTIFY_POS0 __d, const char *__s, | |||
| 198 | } | 198 | } |
| 199 | #endif | 199 | #endif |
| 200 | 200 | ||
| 201 | __access (read_write, 1) | 201 | __fh_access (read_write, 1) |
| 202 | __access (read_only, 2) | 202 | __fh_access (read_only, 2) |
| 203 | #if __has_builtin(__builtin_strcat) | 203 | #if __has_builtin(__builtin_strcat) |
| 204 | __diagnose_as_builtin(__builtin_strcat, 1, 2) | 204 | __diagnose_as_builtin(__builtin_strcat, 1, 2) |
| 205 | #endif | 205 | #endif |
| 206 | _FORTIFY_FN(strcat) char *strcat(char * _FORTIFY_POS0 __d, const char *__s) | 206 | _FORTIFY_FN(strcat) char *strcat(char * _FORTIFY_POS0 __d, const char *__s) |
| 207 | { | 207 | { |
| 208 | #if __has_builtin(__builtin___strcat_chk) && USE_NATIVE_CHK | 208 | #if __has_builtin(__builtin___strcat_chk) && USE_NATIVE_CHK |
| 209 | return __builtin___strcat_chk(__d, __s, __bos(__d, 0)); | 209 | return __builtin___strcat_chk(__d, __s, __fh_bos(__d, 0)); |
| 210 | #else | 210 | #else |
| 211 | __fh_size_t __b = __bos(__d, 0); | 211 | __fh_size_t __b = __fh_bos(__d, 0); |
| 212 | 212 | ||
| 213 | if (strlen(__s) + strlen(__d) + 1 > __b) | 213 | if (strlen(__s) + strlen(__d) + 1 > __b) |
| 214 | __builtin_trap(); | 214 | __builtin_trap(); |
| @@ -216,46 +216,46 @@ _FORTIFY_FN(strcat) char *strcat(char * _FORTIFY_POS0 __d, const char *__s) | |||
| 216 | #endif | 216 | #endif |
| 217 | } | 217 | } |
| 218 | 218 | ||
| 219 | __access (write_only, 1) | 219 | __fh_access (write_only, 1) |
| 220 | __access (read_only, 2) | 220 | __fh_access (read_only, 2) |
| 221 | #if __has_builtin(__builtin_strcpy) | 221 | #if __has_builtin(__builtin_strcpy) |
| 222 | __diagnose_as_builtin(__builtin_strcpy, 1, 2) | 222 | __diagnose_as_builtin(__builtin_strcpy, 1, 2) |
| 223 | #endif | 223 | #endif |
| 224 | _FORTIFY_FN(strcpy) char *strcpy(char * _FORTIFY_POS0 __d, const char *__s) | 224 | _FORTIFY_FN(strcpy) char *strcpy(char * _FORTIFY_POS0 __d, const char *__s) |
| 225 | { | 225 | { |
| 226 | #if __has_builtin(__builtin___strcpy_chk) && USE_NATIVE_CHK | 226 | #if __has_builtin(__builtin___strcpy_chk) && USE_NATIVE_CHK |
| 227 | return __builtin___strcpy_chk(__d, __s, __bos(__d, 0)); | 227 | return __builtin___strcpy_chk(__d, __s, __fh_bos(__d, 0)); |
| 228 | #else | 228 | #else |
| 229 | __fh_size_t __n = strlen(__s) + 1; | 229 | __fh_size_t __n = strlen(__s) + 1; |
| 230 | 230 | ||
| 231 | if (__fh_overlap(__d, __s, __n)) | 231 | if (__fh_overlap(__d, __s, __n)) |
| 232 | __builtin_trap(); | 232 | __builtin_trap(); |
| 233 | 233 | ||
| 234 | __fh_size_t __b = __bos(__d, 0); | 234 | __fh_size_t __b = __fh_bos(__d, 0); |
| 235 | if (__n > __b) | 235 | if (__n > __b) |
| 236 | __builtin_trap(); | 236 | __builtin_trap(); |
| 237 | return __orig_strcpy(__d, __s); | 237 | return __orig_strcpy(__d, __s); |
| 238 | #endif | 238 | #endif |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | __access (read_only, 1) | 241 | __fh_access (read_only, 1) |
| 242 | #if __has_builtin(__builtin_strlen) | 242 | #if __has_builtin(__builtin_strlen) |
| 243 | __diagnose_as_builtin(__builtin_strlen, 1) | 243 | __diagnose_as_builtin(__builtin_strlen, 1) |
| 244 | #endif | 244 | #endif |
| 245 | _FORTIFY_FN(strlen) size_t strlen(const char * _FORTIFY_POS0 __s) | 245 | _FORTIFY_FN(strlen) size_t strlen(const char * _FORTIFY_POS0 __s) |
| 246 | { | 246 | { |
| 247 | #if __has_builtin(__builtin___strlen_chk) && USE_NATIVE_CHK | 247 | #if __has_builtin(__builtin___strlen_chk) && USE_NATIVE_CHK |
| 248 | return __builtin___strlen_chk(__s, __bos(__s, 0)); | 248 | return __builtin___strlen_chk(__s, __fh_bos(__s, 0)); |
| 249 | #else | 249 | #else |
| 250 | __fh_size_t ret = __orig_strlen(__s); | 250 | __fh_size_t ret = __orig_strlen(__s); |
| 251 | if (ret > __bos(__s, 0) - 1) | 251 | if (ret > __fh_bos(__s, 0) - 1) |
| 252 | __builtin_trap(); | 252 | __builtin_trap(); |
| 253 | return ret; | 253 | return ret; |
| 254 | #endif | 254 | #endif |
| 255 | } | 255 | } |
| 256 | 256 | ||
| 257 | __access (read_write, 1) | 257 | __fh_access (read_write, 1) |
| 258 | __access (read_only, 2, 3) | 258 | __fh_access (read_only, 2, 3) |
| 259 | #if __has_builtin(__builtin_strncat) | 259 | #if __has_builtin(__builtin_strncat) |
| 260 | __diagnose_as_builtin(__builtin_strncat, 1, 2, 3) | 260 | __diagnose_as_builtin(__builtin_strncat, 1, 2, 3) |
| 261 | #endif | 261 | #endif |
| @@ -263,9 +263,9 @@ _FORTIFY_FN(strncat) char *strncat(char * _FORTIFY_POS0 __d, const char *__s, | |||
| 263 | size_t __n) | 263 | size_t __n) |
| 264 | { | 264 | { |
| 265 | #if __has_builtin(__builtin___strncat_chk) && USE_NATIVE_CHK | 265 | #if __has_builtin(__builtin___strncat_chk) && USE_NATIVE_CHK |
| 266 | return __builtin___strncat_chk(__d, __s, __n, __bos(__d, 0)); | 266 | return __builtin___strncat_chk(__d, __s, __n, __fh_bos(__d, 0)); |
| 267 | #else | 267 | #else |
| 268 | __fh_size_t __b = __bos(__d, 0); | 268 | __fh_size_t __b = __fh_bos(__d, 0); |
| 269 | 269 | ||
| 270 | if (__n > __b) { | 270 | if (__n > __b) { |
| 271 | __fh_size_t __sl = strnlen(__s, __n); | 271 | __fh_size_t __sl = strnlen(__s, __n); |
| @@ -277,8 +277,8 @@ _FORTIFY_FN(strncat) char *strncat(char * _FORTIFY_POS0 __d, const char *__s, | |||
| 277 | #endif | 277 | #endif |
| 278 | } | 278 | } |
| 279 | 279 | ||
| 280 | __access (write_only, 1) | 280 | __fh_access (write_only, 1) |
| 281 | __access (read_only, 2, 3) | 281 | __fh_access (read_only, 2, 3) |
| 282 | #if __has_builtin(__builtin_strncpy) | 282 | #if __has_builtin(__builtin_strncpy) |
| 283 | __diagnose_as_builtin(__builtin_strncpy, 1, 2, 3) | 283 | __diagnose_as_builtin(__builtin_strncpy, 1, 2, 3) |
| 284 | #endif | 284 | #endif |
| @@ -286,12 +286,12 @@ _FORTIFY_FN(strncpy) char *strncpy(char * _FORTIFY_POS0 __d, | |||
| 286 | const char *__s, size_t __n) | 286 | const char *__s, size_t __n) |
| 287 | { | 287 | { |
| 288 | #if __has_builtin(__builtin___strncpy_chk) && USE_NATIVE_CHK | 288 | #if __has_builtin(__builtin___strncpy_chk) && USE_NATIVE_CHK |
| 289 | return __builtin___strncpy_chk(__d, __s, __n, __bos(__d, 0)); | 289 | return __builtin___strncpy_chk(__d, __s, __n, __fh_bos(__d, 0)); |
| 290 | #else | 290 | #else |
| 291 | if (__fh_overlap(__d, __s, __n)) | 291 | if (__fh_overlap(__d, __s, __n)) |
| 292 | __builtin_trap(); | 292 | __builtin_trap(); |
| 293 | 293 | ||
| 294 | __fh_size_t __b = __bos(__d, 0); | 294 | __fh_size_t __b = __fh_bos(__d, 0); |
| 295 | if (__n > __b) | 295 | if (__n > __b) |
| 296 | __builtin_trap(); | 296 | __builtin_trap(); |
| 297 | return __orig_strncpy(__d, __s, __n); | 297 | return __orig_strncpy(__d, __s, __n); |
| @@ -300,8 +300,8 @@ _FORTIFY_FN(strncpy) char *strncpy(char * _FORTIFY_POS0 __d, | |||
| 300 | 300 | ||
| 301 | #ifdef _GNU_SOURCE | 301 | #ifdef _GNU_SOURCE |
| 302 | #undef mempcpy | 302 | #undef mempcpy |
| 303 | __access(write_only, 1) | 303 | __fh_access(write_only, 1) |
| 304 | __access(read_only, 2, 3) | 304 | __fh_access(read_only, 2, 3) |
| 305 | #if __has_builtin(__builtin_mempcpy) | 305 | #if __has_builtin(__builtin_mempcpy) |
| 306 | __diagnose_as_builtin(__builtin_mempcpy, 1, 2, 3) | 306 | __diagnose_as_builtin(__builtin_mempcpy, 1, 2, 3) |
| 307 | #endif | 307 | #endif |
| @@ -309,10 +309,10 @@ _FORTIFY_FN(mempcpy) void *mempcpy(void * _FORTIFY_POS0 __d, | |||
| 309 | const void * _FORTIFY_POS0 __s, size_t __n) | 309 | const void * _FORTIFY_POS0 __s, size_t __n) |
| 310 | { | 310 | { |
| 311 | #if __has_builtin(__builtin___mempcpy_chk) && USE_NATIVE_CHK | 311 | #if __has_builtin(__builtin___mempcpy_chk) && USE_NATIVE_CHK |
| 312 | return __builtin___mempcpy_chk(__d, __s, __n, __bos(__d, 0)); | 312 | return __builtin___mempcpy_chk(__d, __s, __n, __fh_bos(__d, 0)); |
| 313 | #else | 313 | #else |
| 314 | __fh_size_t __bd = __bos(__d, 0); | 314 | __fh_size_t __bd = __fh_bos(__d, 0); |
| 315 | __fh_size_t __bs = __bos(__s, 0); | 315 | __fh_size_t __bs = __fh_bos(__s, 0); |
| 316 | 316 | ||
| 317 | if (__n > __bd || __n > __bs) | 317 | if (__n > __bd || __n > __bs) |
| 318 | __builtin_trap(); | 318 | __builtin_trap(); |
| @@ -324,8 +324,8 @@ _FORTIFY_FN(mempcpy) void *mempcpy(void * _FORTIFY_POS0 __d, | |||
| 324 | #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) | 324 | #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) |
| 325 | #undef strlcat | 325 | #undef strlcat |
| 326 | #undef strlcpy | 326 | #undef strlcpy |
| 327 | __access (read_write, 1) | 327 | __fh_access (read_write, 1) |
| 328 | __access (read_only, 2, 3) | 328 | __fh_access (read_only, 2, 3) |
| 329 | #if __has_builtin(__builtin_strlcat) | 329 | #if __has_builtin(__builtin_strlcat) |
| 330 | __diagnose_as_builtin(__builtin_strlcat, 1, 2, 3) | 330 | __diagnose_as_builtin(__builtin_strlcat, 1, 2, 3) |
| 331 | #endif | 331 | #endif |
| @@ -333,9 +333,9 @@ _FORTIFY_FN(strlcat) size_t strlcat(char * _FORTIFY_POS0 __d, | |||
| 333 | const char *__s, size_t __n) | 333 | const char *__s, size_t __n) |
| 334 | { | 334 | { |
| 335 | #if __has_builtin(__builtin___strlcat_chk) && USE_NATIVE_CHK | 335 | #if __has_builtin(__builtin___strlcat_chk) && USE_NATIVE_CHK |
| 336 | return __builtin___strlcat_chk(__d, __s, __n, __bos(__d, 0)); | 336 | return __builtin___strlcat_chk(__d, __s, __n, __fh_bos(__d, 0)); |
| 337 | #else | 337 | #else |
| 338 | __fh_size_t __b = __bos(__d, 0); | 338 | __fh_size_t __b = __fh_bos(__d, 0); |
| 339 | 339 | ||
| 340 | if (__n > __b) | 340 | if (__n > __b) |
| 341 | __builtin_trap(); | 341 | __builtin_trap(); |
| @@ -343,8 +343,8 @@ _FORTIFY_FN(strlcat) size_t strlcat(char * _FORTIFY_POS0 __d, | |||
| 343 | #endif | 343 | #endif |
| 344 | } | 344 | } |
| 345 | 345 | ||
| 346 | __access (write_only, 1) | 346 | __fh_access (write_only, 1) |
| 347 | __access (read_only, 2, 3) | 347 | __fh_access (read_only, 2, 3) |
| 348 | #if __has_builtin(__builtin_strlcpy) | 348 | #if __has_builtin(__builtin_strlcpy) |
| 349 | __diagnose_as_builtin(__builtin_strlcpy, 1, 2, 3) | 349 | __diagnose_as_builtin(__builtin_strlcpy, 1, 2, 3) |
| 350 | #endif | 350 | #endif |
| @@ -352,9 +352,9 @@ _FORTIFY_FN(strlcpy) size_t strlcpy(char * _FORTIFY_POS0 __d, | |||
| 352 | const char *__s, size_t __n) | 352 | const char *__s, size_t __n) |
| 353 | { | 353 | { |
| 354 | #if __has_builtin(__builtin___strlcpy_chk) && USE_NATIVE_CHK | 354 | #if __has_builtin(__builtin___strlcpy_chk) && USE_NATIVE_CHK |
| 355 | return __builtin___strlcpy_chk(__d, __s, __n, __bos(__d, 0)); | 355 | return __builtin___strlcpy_chk(__d, __s, __n, __fh_bos(__d, 0)); |
| 356 | #else | 356 | #else |
| 357 | __fh_size_t __b = __bos(__d, 0); | 357 | __fh_size_t __b = __fh_bos(__d, 0); |
| 358 | 358 | ||
| 359 | if (__n > __b) | 359 | if (__n > __b) |
| 360 | __builtin_trap(); | 360 | __builtin_trap(); |
