From 39a955678ac5f16646e5841a720d1d358600dabb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Bollo?= Date: Fri, 22 Sep 2017 07:39:49 +0200 Subject: [PATCH] Make addref for request return the pointer MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Change-Id: I4286cbd9d02b406570185d265e7b925c43bbc42c Signed-off-by: José Bollo --- include/afb/afb-request-itf.h | 2 +- include/afb/afb-request.h | 4 ++-- src/afb-xreq.c | 7 ++++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/afb/afb-request-itf.h b/include/afb/afb-request-itf.h index f28788ee..4c62b3de 100644 --- a/include/afb/afb-request-itf.h +++ b/include/afb/afb-request-itf.h @@ -94,7 +94,7 @@ struct afb_request_itf void *value, void (*free_value)(void*)); - void (*addref)( + struct afb_request *(*addref)( struct afb_request *request); void (*unref)( diff --git a/include/afb/afb-request.h b/include/afb/afb-request.h index 052cbab9..c2585fc5 100644 --- a/include/afb/afb-request.h +++ b/include/afb/afb-request.h @@ -204,9 +204,9 @@ static inline void afb_request_context_clear(struct afb_request *request) * This function MUST be called by asynchronous implementations * of verbs if no reply was sent before returning. */ -static inline void afb_request_addref(struct afb_request *request) +static inline struct afb_request *afb_request_addref(struct afb_request *request) { - request->itf->addref(request); + return request->itf->addref(request); } /* diff --git a/src/afb-xreq.c b/src/afb-xreq.c index 8ff45c4e..b091bd1e 100644 --- a/src/afb-xreq.c +++ b/src/afb-xreq.c @@ -396,10 +396,11 @@ static void xreq_context_set_cb(struct afb_request *closure, void *value, void ( afb_context_set(&xreq->context, value, free_value); } -static void xreq_addref_cb(struct afb_request *closure) +static struct afb_request *xreq_addref_cb(struct afb_request *closure) { struct afb_xreq *xreq = from_request(closure); afb_xreq_unhooked_addref(xreq); + return closure; } static void xreq_unref_cb(struct afb_request *closure) @@ -610,11 +611,11 @@ static void xreq_hooked_context_set_cb(struct afb_request *closure, void *value, xreq_context_set_cb(closure, value, free_value); } -static void xreq_hooked_addref_cb(struct afb_request *closure) +static struct afb_request *xreq_hooked_addref_cb(struct afb_request *closure) { struct afb_xreq *xreq = from_request(closure); afb_hook_xreq_addref(xreq); - xreq_addref_cb(closure); + return xreq_addref_cb(closure); } static void xreq_hooked_unref_cb(struct afb_request *closure) -- 2.16.6