Skip to content

Commit

Permalink
lib-http: Improve http_server_request_set_destroy_callback API
Browse files Browse the repository at this point in the history
It now allows using non-void* context
  • Loading branch information
cmouse committed Jan 24, 2017
1 parent 8b65acb commit 582b936
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib-http/http-server-request.c
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions src/lib-http/http-server.h
Expand Up @@ -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);
Expand Down

0 comments on commit 582b936

Please sign in to comment.