From e94584bf65f0985f1512a9f0c0651dfcc56ed0f2 Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Sun, 22 Jan 2017 17:56:19 +0200 Subject: [PATCH] lib-http: Improve http_client_request_set_destroy_callback It now allows using non-void* context --- src/lib-http/http-client-request.c | 1 + src/lib-http/http-client.h | 3 +++ 2 files changed, 4 insertions(+) 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 -- 2.47.3