From d69f7604c515e211f8021306b5aa51044f927add Mon Sep 17 00:00:00 2001 From: José Bollo Date: Thu, 22 Feb 2018 14:54:47 +0100 Subject: xreq: export a function to get req MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ie7eac225f514349926341b7db61ea0eb9029c5d8 Signed-off-by: José Bollo --- src/afb-xreq.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'src/afb-xreq.c') diff --git a/src/afb-xreq.c b/src/afb-xreq.c index f9a83b5c..cee1a668 100644 --- a/src/afb-xreq.c +++ b/src/afb-xreq.c @@ -66,13 +66,6 @@ inline void afb_xreq_unhooked_unref(struct afb_xreq *xreq) /******************************************************************************/ -static inline struct afb_req to_req(struct afb_xreq *xreq) -{ - return (struct afb_req){ .itf = xreq->request.itf, .closure = &xreq->request }; -} - -/******************************************************************************/ - struct subcall { struct afb_xreq xreq; @@ -179,7 +172,7 @@ static void subcall_on_reply(struct subcall *subcall, int status, struct json_ob static void subcall_req_on_reply(struct subcall *subcall, int status, struct json_object *result) { - subcall->callback_req(subcall->closure, status, result, to_req(subcall->xreq.caller)); + subcall->callback_req(subcall->closure, status, result, xreq_to_req(subcall->xreq.caller)); } static void subcall_request_on_reply(struct subcall *subcall, int status, struct json_object *result) @@ -507,7 +500,7 @@ static void xreq_subcall_req_cb(struct afb_request *closure, const char *api, co sc = subcall_alloc(xreq, api, verb, args); if (sc == NULL) { if (callback) - callback(cb_closure, 1, afb_msg_json_internal_error(), to_req(xreq)); + callback(cb_closure, 1, afb_msg_json_internal_error(), xreq_to_req(xreq)); json_object_put(args); } else { subcall_req(sc, callback, cb_closure); @@ -728,7 +721,7 @@ static void xreq_hooked_subcall_req_cb(struct afb_request *closure, const char * sc = subcall_alloc(xreq, api, verb, args); if (sc == NULL) { if (callback) - callback(cb_closure, 1, afb_msg_json_internal_error(), to_req(xreq)); + callback(cb_closure, 1, afb_msg_json_internal_error(), xreq_to_req(xreq)); json_object_put(args); } else { subcall_req_hooked(sc, callback, cb_closure); @@ -873,7 +866,7 @@ struct afb_req afb_xreq_unstore(struct afb_stored_req *sreq) struct afb_xreq *xreq = (struct afb_xreq *)sreq; if (xreq->hookflags) afb_hook_xreq_unstore(xreq); - return to_req(xreq); + return xreq_to_req(xreq); } struct json_object *afb_xreq_json(struct afb_xreq *xreq) @@ -1033,7 +1026,7 @@ void afb_xreq_call_verb_v1(struct afb_xreq *xreq, const struct afb_verb_desc_v1 afb_xreq_fail_unknown_verb(xreq); else if (!xreq_session_check_apply_v1(xreq, verb->session)) - verb->callback(to_req(xreq)); + verb->callback(xreq_to_req(xreq)); } void afb_xreq_call_verb_v2(struct afb_xreq *xreq, const struct afb_verb_v2 *verb) @@ -1042,7 +1035,7 @@ void afb_xreq_call_verb_v2(struct afb_xreq *xreq, const struct afb_verb_v2 *verb afb_xreq_fail_unknown_verb(xreq); else if (!xreq_session_check_apply_v2(xreq, verb->session, verb->auth)) - verb->callback(to_req(xreq)); + verb->callback(xreq_to_req(xreq)); } void afb_xreq_call_verb_vdyn(struct afb_xreq *xreq, const struct afb_api_dyn_verb *verb) -- cgit 1.2.3-korg