18#ifndef CS_COMMON_STR_UTIL_H_
19#define CS_COMMON_STR_UTIL_H_
27#ifndef CS_ENABLE_STRDUP
28#define CS_ENABLE_STRDUP 0
32#define CS_ENABLE_TO64 0
39#if !defined(_MSC_VER) || _MSC_VER >= 1900
40#define CS_STRINGIFY_LIT(...) #__VA_ARGS__
42#define CS_STRINGIFY_LIT(x) #x
54#define CS_STRINGIFY_MACRO(x) CS_STRINGIFY_LIT(x)
63size_t c_strnlen(
const char* s,
size_t maxlen);
68int c_snprintf(
char* buf,
size_t buf_size,
const char* format, ...) PRINTF_LIKE(3, 4);
73int c_vsnprintf(
char* buf,
size_t buf_size, const
char* format, va_list ap);
79const
char* c_strnstr(const
char* s, const
char* find,
size_t slen);
86void cs_to_hex(
char* to, const
unsigned char* p,
size_t len);
92void cs_from_hex(
char* to, const
char* p,
size_t len);
98char* strdup(
const char* src);
106int64_t cs_to64(
const char* s);
112int mg_ncasecmp(
const char* s1,
const char* s2,
size_t len);
117int mg_casecmp(
const char* s1,
const char* s2);
136int mg_asprintf(
char** buf,
size_t size,
const char* fmt, ...) PRINTF_LIKE(3, 4);
139int mg_avprintf(
char** buf,
size_t size, const
char* fmt, va_list ap);
154const
char* mg_next_comma_list_entry(const
char* list, struct
mg_str* val, struct
mg_str* eq_val);
162 mg_next_comma_list_entry_n(struct
mg_str list, struct
mg_str* val, struct
mg_str* eq_val);
184size_t mg_match_prefix(const
char* pattern,
int pattern_len, const
char* str);
189size_t mg_match_prefix_n(const struct
mg_str pattern, const struct
mg_str str);