summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-10-25 19:10:45 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-12-13 15:02:54 +0100
commit6d70dd06ac391b2bcae106121d0ca350eba3d1c4 (patch)
tree8f37a71741fab56425fd5960c358d93317f9e4aa
parent8b005882eda47decef8743061536db091e6b5303 (diff)
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 <romain.forlot@iot.bzh>
-rw-r--r--ctl-lib/ctl-plugin.h7
1 files changed, 7 insertions, 0 deletions
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