From 6d70dd06ac391b2bcae106121d0ca350eba3d1c4 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Wed, 25 Oct 2017 19:10:45 +0200 Subject: Replace macro by apiV2 compatible inline function Signature from apiv2 and apiv3 aren't the same so better use an inline function here to be able to return a pointer. Change-Id: I2e811a37337ca1a4f1015a060e147c69370aa63c Signed-off-by: Romain Forlot --- ctl-lib/ctl-plugin.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ctl-lib/ctl-plugin.h b/ctl-lib/ctl-plugin.h index d02670d..2613f9b 100644 --- a/ctl-lib/ctl-plugin.h +++ b/ctl-lib/ctl-plugin.h @@ -128,6 +128,13 @@ #define AFB_ClientCtxSet(request, replace, createCB, freeCB, handle) afb_req_context_set(request, createCB(handle), freeCB) #define AFB_ClientCtxClear(request) afb_req_context_clear(request) + static inline void* AFB_ClientCtxSet(afb_req request, int replace, void *(*create_context)(void *closure), void (*free_context)(void*), void *closure) + { + void *ctx = create_context(closure); + if(ctx) + {afb_req_context_set(request, ctx, free_context);} + return ctx; + } #define AFB_ApiVerbs afb_verb_v2 -- cgit 1.2.3-korg