diff options
author | José Bollo <jose.bollo@iot.bzh> | 2016-06-10 14:29:14 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2016-06-10 14:29:14 +0200 |
commit | b69290c369ba67ee804bc5a0a440210c0e5d37a3 (patch) | |
tree | 13e8ea4b4d37fd8239b2fc395cb3df6af214da2d /src/afb-api-dbus.c | |
parent | 17b196f1326d6b6c249d44b8744d73d7bba12d7a (diff) |
common code reuse
Change-Id: I5f400a92165bb380ec5f703dd8ca567e90aebca2
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-api-dbus.c')
-rw-r--r-- | src/afb-api-dbus.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/src/afb-api-dbus.c b/src/afb-api-dbus.c index 905c723d..7452339b 100644 --- a/src/afb-api-dbus.c +++ b/src/afb-api-dbus.c @@ -32,6 +32,7 @@ #include "afb-common.h" #include "session.h" +#include "afb-msg-json.h" #include "afb-apis.h" #include "afb-api-so.h" #include "afb-context.h" @@ -400,19 +401,7 @@ static struct json_object *dbus_req_json(struct dbus_req *dreq) /* get the argument of the request of 'name' */ static struct afb_arg dbus_req_get(struct dbus_req *dreq, const char *name) { - struct afb_arg arg; - struct json_object *value, *root; - - root = dbus_req_json(dreq); - if (root != NULL && json_object_object_get_ex(root, name, &value)) { - arg.name = name; - arg.value = json_object_get_string(value); - } else { - arg.name = NULL; - arg.value = NULL; - } - arg.path = NULL; - return arg; + return afb_msg_json_get_arg(dbus_req_json(dreq), name); } static void dbus_req_reply(struct dbus_req *dreq, uint8_t type, const char *first, const char *second) |