mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-25 12:04:47 +00:00
Introduce mg_calloc
This commit is contained in:
1 parent
5f1f4a0df8
commit
074ef5197b
26 files changed
+259
-313
No files matched your search
@@ -3,7 +3,7 @@
|
||||
|
||||
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));
|
||||
struct mg_rpc *rpc = (struct mg_rpc *) mg_calloc(1, sizeof(*rpc));
|
||||
if (rpc != NULL) {
|
||||
rpc->method = mg_strdup(method);
|
||||
rpc->fn = fn;
|
||||
@@ -17,8 +17,8 @@ void mg_rpc_del(struct mg_rpc **head, void (*fn)(struct mg_rpc_req *)) {
|
||||
while ((r = *head) != NULL) {
|
||||
if (r->fn == fn || fn == NULL) {
|
||||
*head = r->next;
|
||||
free((void *) r->method.buf);
|
||||
free(r);
|
||||
mg_free((void *) r->method.buf);
|
||||
mg_free(r);
|
||||
} else {
|
||||
head = &(*head)->next;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user