cleanup 'str' API

This commit is contained in:
Sergio R. Caprile committed 2024-05-09 14:10:27 -03:00
1 parent 6c7672f4af
commit 3c531897b6
20 files changed
+350 -400

No files matched your search

+4 -1
View File
@@ -5,7 +5,10 @@ void mg_rpc_add(struct mg_rpc **head, struct mg_str method,
void (*fn)(struct mg_rpc_req *), void *fn_data) {
struct mg_rpc *rpc = (struct mg_rpc *) calloc(1, sizeof(*rpc));
if (rpc != NULL) {
rpc->method = mg_strdup(method), rpc->fn = fn, rpc->fn_data = fn_data;
rpc->method.buf = mg_mprintf("%.*s", method.len, method.buf);
rpc->method.len = method.len;
rpc->fn = fn;
rpc->fn_data = fn_data;
rpc->next = *head, *head = rpc;
}
}