From fa4745b4bac682f0a265b956a90bb7a84ef51192 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Mon, 6 Mar 2023 00:59:07 +0100 Subject: Perform some minor optimizations --- handler.c | 5 ++--- handler.h | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/handler.c b/handler.c index 1d378a9..6a3d626 100644 --- a/handler.c +++ b/handler.c @@ -311,8 +311,7 @@ int handler_add(struct handler *const h, const char *url, const enum http_op op, const handler_fn f, void *const user) { const size_t n = h->n_cfg + 1; - struct handler_cfg *const cfgs = realloc(h->cfg, n * sizeof *h->cfg), - *c = NULL; + struct handler_cfg *const cfgs = realloc(h->cfg, n * sizeof *h->cfg); if (!cfgs) { @@ -320,7 +319,7 @@ int handler_add(struct handler *const h, const char *url, return -1; } - c = &cfgs[h->n_cfg]; + struct handler_cfg *const c = &cfgs[h->n_cfg]; *c = (const struct handler_cfg) { diff --git a/handler.h b/handler.h index 8550010..69f8cbf 100644 --- a/handler.h +++ b/handler.h @@ -4,7 +4,6 @@ #include "http.h" #include -struct handler; typedef int (*handler_fn)(const struct http_payload *p, struct http_response *r, void *user); -- cgit v1.2.3