diff options
| -rw-r--r-- | handler.c | 5 | ||||
| -rw-r--r-- | handler.h | 1 | ||||
| -rw-r--r-- | page.c | 7 |
3 files changed, 3 insertions, 10 deletions
@@ -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) { @@ -4,7 +4,6 @@ #include "http.h" #include <stddef.h> -struct handler; typedef int (*handler_fn)(const struct http_payload *p, struct http_response *r, void *user); @@ -39,11 +39,6 @@ " <input type=\"submit\" value=\"Submit\">\n" \ " </form>\n" -static void free_response(void *const arg) -{ - free(arg); -} - static int prepare_name(struct html_node *const n, struct stat *const sb, const char *const dir, const char *const name) { @@ -608,7 +603,7 @@ static int list_dir(struct http_response *const r, const char *const dir, .status = HTTP_STATUS_OK, .buf.rw = out.str, .n = out.len, - .free = free_response + .free = free }; if (http_response_add_header(r, "Content-Type", "text/html")) |
