Get rid of mg_*asprintf

This commit is contained in:
cpq committed 2022-08-13 15:37:55 +01:00
1 parent ccf5364187
commit d76f86f7db
13 files changed
+88 -244

No files matched your search

+2 -3
View File
@@ -12,13 +12,12 @@ void mg_call(struct mg_connection *c, int ev, void *ev_data) {
}
void mg_error(struct mg_connection *c, const char *fmt, ...) {
char mem[256], *buf = mem;
char buf[64];
va_list ap;
va_start(ap, fmt);
mg_vasprintf(&buf, sizeof(mem), fmt, ap);
mg_vsnprintf(buf, sizeof(buf), fmt, &ap);
va_end(ap);
MG_ERROR(("%lu %p %s", c->id, c->fd, buf));
c->is_closing = 1; // Set is_closing before sending MG_EV_CALL
mg_call(c, MG_EV_ERROR, buf); // Let user handler to override it
if (buf != mem) free(buf);
}