summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-04-27 12:02:25 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-04-27 12:06:10 +0200
commit34acb0f8d191593c9761e027424f13ae42831133 (patch)
tree607110bfccf215233fab5c6bac6472bed6656c55 /include
parent8dff3447cea6df8ab727d9615cd07b3774ccffa0 (diff)
adds store/unstore for afb_req
Change-Id: If93e243378efbb6329bb9cc60d869261ddc33c48 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'include')
-rw-r--r--include/afb-req-itf.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/include/afb-req-itf.h b/include/afb-req-itf.h
index f03ce868..d4ade2be 100644
--- a/include/afb-req-itf.h
+++ b/include/afb-req-itf.h
@@ -120,12 +120,28 @@ static inline void afb_req_session_close(struct afb_req req)
req.itf->session_close(req.req_closure);
}
+#include <stdlib.h>
+
+static inline struct afb_req *afb_req_store(struct afb_req req)
+{
+ struct afb_req *result = malloc(sizeof *result);
+ if (result != NULL)
+ *result = req;
+ return result;
+}
+
+static inline struct afb_req afb_req_unstore(struct afb_req *req)
+{
+ struct afb_req result = *req;
+ free(req);
+ return result;
+}
+
#if !defined(_GNU_SOURCE)
# error "_GNU_SOURCE must be defined for using vasprintf"
#endif
#include <stdarg.h>
-#include <stdlib.h>
#include <stdio.h>
static inline void afb_req_fail_v(struct afb_req req, const char *status, const char *info, va_list args)