Skip to content
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

Merged
merged 1 commit into from
Feb 4, 2024
Merged

mg_split -> mg_span. Remove mg_commalist #2597

merged 1 commit into from
Feb 4, 2024

Conversation

cpq
Copy link
Member

@cpq cpq commented Feb 2, 2024

No description provided.

@cpq cpq requested a review from scaprile February 3, 2024 10:48
@cpq cpq force-pushed the str branch 4 times, most recently from ecdd2bc to 665f456 Compare February 4, 2024 09:22
@cpq
Copy link
Member Author

cpq commented Feb 4, 2024

Pushing - please review later.

@cpq cpq merged commit e4bfb2b into master Feb 4, 2024
62 of 63 checks passed
@cpq cpq deleted the str branch February 4, 2024 09:39
@@ -3262,20 +3230,55 @@ static void test_sha1(void) {
test_sha1_str(")_)+_)!&^*%$#>>>{}}}{{{][[[[]]]", expected_hash_3);
}


static void test_split(void) {
Copy link
Collaborator

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 {
Copy link
Collaborator

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

Comment on lines +136 to +140
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
Copy link
Collaborator

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));
Copy link
Collaborator

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants