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

+3 -3
View File
@@ -1260,7 +1260,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;
}
@@ -1820,7 +1820,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);
}
@@ -4230,7 +4230,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);