]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: Improve http_client_request_set_destroy_callback
authorAki Tuomi <aki.tuomi@dovecot.fi>
Sun, 22 Jan 2017 15:56:19 +0000 (17:56 +0200)
committerGitLab <gitlab@git.dovecot.net>
Tue, 24 Jan 2017 07:43:58 +0000 (09:43 +0200)
It now allows using non-void* context

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

index 0cff311f3ebf213efcd5b453017006e3bb691384..6b6cf10366fe99de9895af216be268336376a00b 100644 (file)
@@ -1415,6 +1415,7 @@ bool http_client_request_try_retry(struct http_client_request *req)
        return TRUE;
 }
 
+#undef http_client_request_set_destroy_callback
 void http_client_request_set_destroy_callback(struct http_client_request *req,
                                              void (*callback)(void *),
                                              void *context)
index 0228503667d7d59f7f542a4f75b692d613b671e1..d977f76485a0a34028281f4a3c4e4c46300914f7 100644 (file)
@@ -348,6 +348,9 @@ void http_client_request_abort(struct http_client_request **req);
 void http_client_request_set_destroy_callback(struct http_client_request *req,
                                              void (*callback)(void *),
                                              void *context);
+#define http_client_request_set_destroy_callback(req, callback, context) \
+        http_client_request_set_destroy_callback(req, (void(*)(void*))callback, context + \
+                CALLBACK_TYPECHECK(callback, void (*)(typeof(context))))
 
 /* submits request and blocks until the provided payload is sent. Multiple
    calls are allowed; payload transmission is ended with