-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mg_split -> mg_span. Remove mg_commalist #2597
Conversation
ecdd2bc
to
665f456
Compare
Pushing - please review later. |
@@ -3262,20 +3230,55 @@ static void test_sha1(void) { | |||
test_sha1_str(")_)+_)!&^*%$#>>>{}}}{{{][[[[]]]", expected_hash_3); | |||
} | |||
|
|||
|
|||
static void test_split(void) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test_span ?
bool mg_span(struct mg_str s, struct mg_str *a, struct mg_str *b, char sep) { | ||
if (s.len == 0 || s.ptr == NULL) { | ||
return false; // Empty string, nothing to span - fail | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No actual need for this else clause
size_t len = 0; | ||
while (len < s.len && s.ptr[len] != sep) len++; // Find separator | ||
if (a) *a = mg_str_n(s.ptr, len); // Init a | ||
if (b) *b = mg_str_n(s.ptr + len, s.len - len); // Init b | ||
if (b && len < s.len) b->ptr++, b->len--; // Skip separator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool...
@@ -42,7 +42,7 @@ static void sntp_cb(struct mg_connection *c, int ev, void *ev_data) { | |||
if (ev == MG_EV_READ) { | |||
int64_t milliseconds = mg_sntp_parse(c->recv.buf, c->recv.len); | |||
if (milliseconds > 0) { | |||
MG_INFO(("%lu got time: %lld ms from epoch", c->id, milliseconds)); | |||
MG_DEBUG(("%lu got time: %lld ms from epoch", c->id, milliseconds)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmm... I'm not sure...
We have other events that are INFO, in MIP for example. Yes, those are more important...
No description provided.