strfuncs.h (dovecot-2.3.16) | : | strfuncs.h (dovecot-2.3.17) | ||
---|---|---|---|---|
skipping to change at line 100 | skipping to change at line 100 | |||
static inline ATTR_PURE bool str_begins(const char *haystack, const char *needle ) | static inline ATTR_PURE bool str_begins(const char *haystack, const char *needle ) | |||
{ | { | |||
return needle[str_match(haystack, needle)] == '\0'; | return needle[str_match(haystack, needle)] == '\0'; | |||
} | } | |||
#if defined(__GNUC__) && (__GNUC__ >= 2) | #if defined(__GNUC__) && (__GNUC__ >= 2) | |||
/* GCC (and Clang) are known to have a compile-time strlen("literal") shortcut, and | /* GCC (and Clang) are known to have a compile-time strlen("literal") shortcut, and | |||
an optimised strncmp(), so use that by default. Macro is multi-evaluation saf e. */ | an optimised strncmp(), so use that by default. Macro is multi-evaluation saf e. */ | |||
# define str_begins(h, n) (__builtin_constant_p(n) ? strncmp((h), (n), strlen(n) )==0 : (str_begins)((h), (n))) | # define str_begins(h, n) (__builtin_constant_p(n) ? strncmp((h), (n), strlen(n) )==0 : (str_begins)((h), (n))) | |||
#endif | #endif | |||
/* Get length of a prefix segment. | ||||
Calculates the length (in bytes) of the initial segment of s which consists | ||||
entirely of bytes in accept. | ||||
*/ | ||||
size_t i_memspn(const void *data, size_t data_len, | ||||
const void *accept, size_t accept_len); | ||||
/* Get length of a prefix segment. | ||||
Calculates the length of the initial segment of s which consists entirely of | ||||
bytes not in reject. | ||||
*/ | ||||
size_t i_memcspn(const void *data, size_t data_len, | ||||
const void *reject, size_t reject_len); | ||||
static inline char *i_strchr_to_next(const char *str, char chr) | static inline char *i_strchr_to_next(const char *str, char chr) | |||
{ | { | |||
char *tmp = (char *)strchr(str, chr); | char *tmp = (char *)strchr(str, chr); | |||
return tmp == NULL ? NULL : tmp+1; | return tmp == NULL ? NULL : tmp+1; | |||
} | } | |||
/* separators is an array of separator characters, not a separator string. | /* separators is an array of separator characters, not a separator string. | |||
an empty data string results in an array containing only NULL. */ | an empty data string results in an array containing only NULL. */ | |||
char **p_strsplit(pool_t pool, const char *data, const char *separators) | char **p_strsplit(pool_t pool, const char *data, const char *separators) | |||
ATTR_MALLOC ATTR_RETURNS_NONNULL; | ATTR_MALLOC ATTR_RETURNS_NONNULL; | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 15 lines changed or added |