]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: Improve http_server_request_set_destroy_callback API
authorAki Tuomi <aki.tuomi@dovecot.fi>
Tue, 24 Jan 2017 07:55:49 +0000 (09:55 +0200)
committerAki Tuomi <aki.tuomi@dovecot.fi>
Tue, 24 Jan 2017 07:55:49 +0000 (09:55 +0200)
It now allows using non-void* context

src/lib-http/http-server-request.c
src/lib-http/http-server.h

index 6d94bebc050f2607d14acdaf49262ebc164f2035..96a24e9f048312aef7f6b046396e817816d82561 100644 (file)
@@ -114,6 +114,7 @@ void http_server_request_destroy(struct http_server_request **_req)
        http_server_request_unref(_req);
 }
 
+#undef http_server_request_set_destroy_callback
 void http_server_request_set_destroy_callback(struct http_server_request *req,
                                              void (*callback)(void *),
                                              void *context)
index 3744dc6662797fc287f591c0a748e4ae3ca120de..bb311aeea49ce59fb2a56ef95347bfaf1aaf0100 100644 (file)
@@ -148,6 +148,9 @@ void http_server_request_fail_auth_basic(struct http_server_request *req,
 void http_server_request_set_destroy_callback(struct http_server_request *req,
                                              void (*callback)(void *),
                                              void *context);
+#define http_server_request_set_destroy_callback(req, callback, context) \
+       http_server_request_set_destroy_callback(req, (void(*)(void*))callback, context + \
+               CALLBACK_TYPECHECK(callback, void (*)(typeof(context))))
 
 /* Reference a server request */
 void http_server_request_ref(struct http_server_request *req);