From 08a28337118f5474b6ce73d3024dbd88d994cb93 Mon Sep 17 00:00:00 2001 From: Kazumasa Mitsunari Date: Thu, 8 Mar 2018 12:08:11 +0900 Subject: Clean: clean up duplicate code Change-Id: I99fdddbefa5fbb36bd0185a7541c7ff4eb4c921f Signed-off-by: Kazumasa Mitsunari --- src/sm-helper.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/sm-helper.c') diff --git a/src/sm-helper.c b/src/sm-helper.c index 3794c30..f9e7ec3 100644 --- a/src/sm-helper.c +++ b/src/sm-helper.c @@ -229,3 +229,22 @@ GVariant* create_domain_data(struct domain_data* data) AFB_DEBUG("created domainData %d", __LINE__); return g_variant_builder_end (&builder); } + +bool send_result(const GError* result_of_send, struct afb_req req, const char* function){ + /* GError = NULL means success in case of gdbus request */ + if(result_of_send != NULL) + { + AFB_ERROR("Unable to call %s", function); + afb_req_fail_f(req, "failed", "Unable to call %s", function); + return false; + } + return true; +} + +bool send_result_no_resp(const GError* result_of_send, const char* function){ + if(result_of_send != NULL){ + AFB_ERROR("Unable to call %s", function); + return false; + } + return true; +} \ No newline at end of file -- cgit 1.2.3-korg