From: Aki Tuomi Date: Sun, 22 Jan 2017 15:56:19 +0000 (+0200) Subject: lib-http: Improve http_client_request_set_destroy_callback X-Git-Tag: 2.3.0.rc1~2273 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e94584bf65f0985f1512a9f0c0651dfcc56ed0f2;p=thirdparty%2Fdovecot%2Fcore.git lib-http: Improve http_client_request_set_destroy_callback It now allows using non-void* context --- diff --git a/src/lib-http/http-client-request.c b/src/lib-http/http-client-request.c index 0cff311f3e..6b6cf10366 100644 --- a/src/lib-http/http-client-request.c +++ b/src/lib-http/http-client-request.c @@ -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) diff --git a/src/lib-http/http-client.h b/src/lib-http/http-client.h index 0228503667..d977f76485 100644 --- a/src/lib-http/http-client.h +++ b/src/lib-http/http-client.h @@ -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