mg_next_comma_entry -> mg_comma

This commit is contained in:
Sergey Lyubka committed 2021-08-23 16:54:58 +01:00
1 parent 9b37ac384f
commit 1c456fc2df
9 files changed
+23 -23

No files matched your search

+1 -1
View File
@@ -489,7 +489,7 @@ static struct mg_str guess_content_type(struct mg_str path, const char *extra) {
path.len = i;
// Process user-provided mime type overrides, if any
while (mg_next_comma_entry(&s, &k, &v)) {
while (mg_comma(&s, &k, &v)) {
if (mg_strcmp(path, k) == 0) return v;
}
+1 -1
View File
@@ -27,7 +27,7 @@ bool mg_log_prefix(int level, const char *file, int line, const char *fname) {
if (p == NULL) p = strrchr(file, '\\');
p = p == NULL ? file : p + 1;
while (mg_next_comma_entry(&s, &k, &v)) {
while (mg_comma(&s, &k, &v)) {
if (v.len == 0) max = atoi(k.ptr);
if (v.len > 0 && strncmp(p, k.ptr, k.len) == 0) max = atoi(v.ptr);
}
+1 -1
View File
@@ -108,7 +108,7 @@ static size_t mg_nce(const char *s, size_t n, size_t ofs, size_t *koff,
return ofs > n ? n : ofs;
}
bool mg_next_comma_entry(struct mg_str *s, struct mg_str *k, struct mg_str *v) {
bool mg_comma(struct mg_str *s, struct mg_str *k, struct mg_str *v) {
size_t koff = 0, klen = 0, voff = 0, vlen = 0;
size_t off = mg_nce(s->ptr, s->len, 0, &koff, &klen, &voff, &vlen);
if (k != NULL) *k = mg_str_n(s->ptr + koff, klen);
+1 -1
View File
@@ -8,7 +8,7 @@ bool mg_file_write(const char *path, const void *buf, size_t len);
bool mg_file_printf(const char *path, const char *fmt, ...);
void mg_random(void *buf, size_t len);
bool mg_globmatch(const char *pattern, size_t plen, const char *s, size_t n);
bool mg_next_comma_entry(struct mg_str *s, struct mg_str *k, struct mg_str *v);
bool mg_comma(struct mg_str *s, struct mg_str *k, struct mg_str *v);
uint16_t mg_ntohs(uint16_t net);
uint32_t mg_ntohl(uint32_t net);
uint32_t mg_crc32(uint32_t crc, const char *buf, size_t len);