string
include/string.h View source View on GitHubFunctions
Section titled “Functions”memcpy
Section titled “memcpy”void * memcpy(void *dest, const void *src, size_t n) source memset
Section titled “memset”void * memset(void *s, int c, size_t n) source memmove
Section titled “memmove”void * memmove(void *dest, const void *src, size_t n) source memchr
Section titled “memchr”void * memchr(const void *s, int c, size_t n) source memrchr
Section titled “memrchr”void * memrchr(const void *s, int c, size_t n) source memmem
Section titled “memmem”void * memmem(
const void *haystack,
size_t haystack_len,
const void *needle,
size_t needle_len
) source mempcpy
Section titled “mempcpy”void * mempcpy(void *dest, const void *src, size_t n) source __memset_inline
Section titled “__memset_inline”__STRING_FAST void * __memset_inline(void *s, int c, size_t n) source __memcpy_inline
Section titled “__memcpy_inline”__STRING_FAST void * __memcpy_inline(
void *dest,
const void *src,
size_t n
) source __memmove_inline
Section titled “__memmove_inline”__STRING_FAST void * __memmove_inline(
void *dest,
const void *src,
size_t n
) source __memcmp_inline
Section titled “__memcmp_inline”__STRING_FAST int __memcmp_inline(
const void *s1,
const void *s2,
size_t n
) source fortify_panic
Section titled “fortify_panic”cc_noreturn void fortify_panic(
const char *fn,
size_t want,
size_t have
) source strcpy
Section titled “strcpy”char * strcpy(char *dest, const char *src) source stpcpy
Section titled “stpcpy”char * stpcpy(char *dest, const char *src) source Return the terminator
stpncpy
Section titled “stpncpy”char * stpncpy(char *dest, const char *src, size_t n) source Pad to n bytes and return the first written NUL, or dest + n if truncated
strcat
Section titled “strcat”char * strcat(char *dest, const char *src) source strncpy
Section titled “strncpy”char * strncpy(char *dest, const char *src, size_t n) source strchr
Section titled “strchr”char * strchr(const char *s, int c) source strrchr
Section titled “strrchr”char * strrchr(const char *s, int c) source strpbrk
Section titled “strpbrk”char * strpbrk(const char *s, const char *accept) source strstr
Section titled “strstr”char * strstr(const char *haystack, const char *needle) source strcasestr
Section titled “strcasestr”char * strcasestr(const char *haystack, const char *needle) source strnstr
Section titled “strnstr”char * strnstr(const char *haystack, const char *needle, size_t len) source strncasestr
Section titled “strncasestr”char * strncasestr(
const char *haystack,
const char *needle,
size_t len
) source strtok
Section titled “strtok”char * strtok(char *str, const char *delim) source strtok_r
Section titled “strtok_r”char * strtok_r(char *str, const char *delim, char **saveptr) source strncat
Section titled “strncat”char * strncat(char *dest, const char *src, size_t n) source strdup
Section titled “strdup”char * strdup(const char *str) source strndup
Section titled “strndup”char * strndup(const char *str, size_t n) source strrev
Section titled “strrev”char * strrev(char *s) source strtoupper
Section titled “strtoupper”char * strtoupper(char *s) source strtolower
Section titled “strtolower”char * strtolower(char *s) source char * itoa(int64_t value, char *buf, int base) source char * utoa(size_t value, char *buf, int base) source strsep
Section titled “strsep”char * strsep(char **stringp, const char *delim) source strchrnul
Section titled “strchrnul”char * strchrnul(const char *s, int c) source Macros
Section titled “Macros”__STRING_FAST
Section titled “__STRING_FAST”#define __STRING_FAST static inline __attribute__((always_inline, artificial)) source _fortify_obj
Section titled “_fortify_obj”#define _fortify_obj(p) source Expansion
#define _fortify_obj(p) __builtin_dynamic_object_size((p), 0) _fortify_check
Section titled “_fortify_check”#define _fortify_check(fn, p, n) source Expansion
#define _fortify_check(fn, p, n) \
({ \
size_t _fortify_have_ = _fortify_obj(p); \
size_t _fortify_want_ = (n); \
if (__builtin_constant_p(_fortify_want_ > _fortify_have_) && \
_fortify_want_ > _fortify_have_) \
__fortify_overflow(); \
else if (cc_unlikely(_fortify_want_ > _fortify_have_)) \
fortify_panic(fn, _fortify_want_, _fortify_have_); \
}) _fortify_str_check
Section titled “_fortify_str_check”#define _fortify_str_check(fn, d, need_expr) source Expansion
#define _fortify_str_check(fn, d, need_expr) \
({ \
if (_fortify_obj(d) != SIZE_MAX) \
_fortify_check(fn, d, (need_expr)); \
}) memset
Section titled “memset”#define memset(s, c, n) source Expansion
#define memset(s, c, n) \
({ \
size_t _memset_n_ = (n); \
_fortify_check("memset", s, _memset_n_); \
__memset_inline((s), (c), _memset_n_); \
}) memcpy
Section titled “memcpy”#define memcpy(d, s, n) source Expansion
#define memcpy(d, s, n) \
({ \
size_t _memcpy_n_ = (n); \
_fortify_check("memcpy", d, _memcpy_n_); \
_fortify_check("memcpy", s, _memcpy_n_); \
__memcpy_inline((d), (s), _memcpy_n_); \
}) memmove
Section titled “memmove”#define memmove(d, s, n) source Expansion
#define memmove(d, s, n) \
({ \
size_t _memmove_n_ = (n); \
_fortify_check("memmove", d, _memmove_n_); \
_fortify_check("memmove", s, _memmove_n_); \
__memmove_inline((d), (s), _memmove_n_); \
}) memcmp
Section titled “memcmp”#define memcmp(a, b, n) source Expansion
#define memcmp(a, b, n) \
({ \
size_t _memcmp_n_ = (n); \
_fortify_check("memcmp", a, _memcmp_n_); \
_fortify_check("memcmp", b, _memcmp_n_); \
__memcmp_inline((a), (b), _memcmp_n_); \
}) strdup
Section titled “strdup”#define strdup vstrdup source strndup
Section titled “strndup”#define strndup vstrndup source strcpy
Section titled “strcpy”#define strcpy(d, s) source Expansion
#define strcpy(d, s) \
({ \
_fortify_str_check("strcpy", d, __builtin_strlen(s) + 1); \
(strcpy)((d), (s)); \
}) stpcpy
Section titled “stpcpy”#define stpcpy(d, s) source Expansion
#define stpcpy(d, s) \
({ \
_fortify_str_check("stpcpy", d, __builtin_strlen(s) + 1); \
(stpcpy)((d), (s)); \
}) strcat
Section titled “strcat”#define strcat(d, s) source Expansion
#define strcat(d, s) \
({ \
_fortify_str_check("strcat", d, \
__builtin_strlen(d) + __builtin_strlen(s) + 1); \
(strcat)((d), (s)); \
}) strncpy
Section titled “strncpy”#define strncpy(d, s, n) source Expansion
#define strncpy(d, s, n) \
({ \
size_t _strncpy_n_ = (n); \
_fortify_check("strncpy", d, _strncpy_n_); \
(strncpy)((d), (s), _strncpy_n_); \
}) stpncpy
Section titled “stpncpy”#define stpncpy(d, s, n) source Expansion
#define stpncpy(d, s, n) \
({ \
size_t _stpncpy_n_ = (n); \
_fortify_check("stpncpy", d, _stpncpy_n_); \
(stpncpy)((d), (s), _stpncpy_n_); \
}) strlcpy
Section titled “strlcpy”#define strlcpy(d, s, n) source Expansion
#define strlcpy(d, s, n) \
({ \
size_t _strlcpy_n_ = (n); \
_fortify_check("strlcpy", d, _strlcpy_n_); \
(strlcpy)((d), (s), _strlcpy_n_); \
}) strlcat
Section titled “strlcat”#define strlcat(d, s, n) source Expansion
#define strlcat(d, s, n) \
({ \
size_t _strlcat_n_ = (n); \
_fortify_check("strlcat", d, _strlcat_n_); \
(strlcat)((d), (s), _strlcat_n_); \
}) snprintf
Section titled “snprintf”#define snprintf(buf, len, ...) source Expansion
#define snprintf(buf, len, ...) \
({ \
int _snprintf_len_ = (len); \
if (_snprintf_len_ > 0) \
_fortify_check("snprintf", buf, (size_t) _snprintf_len_); \
(snprintf)((buf), _snprintf_len_, __VA_ARGS__); \
})