Skip to content

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
@cpq cpq deleted the str branch February 4, 2024 09:39
}


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

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.

3 participants