summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2018-05-27 18:29:37 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2018-10-08 15:51:00 +0200
commit88a68355d6f0e0190eeff55d778525ca3bafebf6 (patch)
treeffc45f76232c7c7cd32ab48f7f842fd34724b8ea
parent00bb4d0ca0417f231715844e613c46dd69f241fd (diff)
Regroup declaration of variables in functions
Regroup declaration of variables in 'HalMgrLoaded' function. Add error info when responding that the request have failed. Change-Id: Ib25159f37928bd8cc442e9db08b280e93b6b568b Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
-rw-r--r--4a-hal/4a-hal-manager/4a-hal-manager-cb.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/4a-hal/4a-hal-manager/4a-hal-manager-cb.c b/4a-hal/4a-hal-manager/4a-hal-manager-cb.c
index 704838f..e4d9cc7 100644
--- a/4a-hal/4a-hal-manager/4a-hal-manager-cb.c
+++ b/4a-hal/4a-hal-manager/4a-hal-manager-cb.c
@@ -72,25 +72,23 @@ void HalMgrLoaded(afb_request *request)
struct HalMgrData *HalMgrGlobalData;
struct SpecificHalData *currentHalData;
- struct json_object *requestJson;
- struct json_object *requestAnswer;
- struct json_object *apiObject;
+ struct json_object *requestJson, *requestAnswer, *apiObject;
apiHandle = (afb_dynapi *) afb_request_get_dynapi(request);
if(! apiHandle) {
- afb_request_fail(request, "ERROR", "Can't get HalManager Api handle");
+ afb_request_fail(request, "api_handle", "Can't get hal manager api handle");
return;
}
HalMgrGlobalData = (struct HalMgrData *) afb_dynapi_get_userdata(apiHandle);
if(! HalMgrGlobalData) {
- afb_request_fail(request, "ERROR", "Can't get HalManager data");
+ afb_request_fail(request, "hal_manager_data", "Can't get hal manager data");
return;
}
requestJson = afb_request_json(request);
if(! requestJson) {
- afb_request_fail(request, "ERROR", "Can't get request json");
+ afb_request_fail(request, "request_json", "Can't get request json");
return;
}
@@ -102,7 +100,7 @@ void HalMgrLoaded(afb_request *request)
requestAnswer = json_object_new_array();
if(! requestAnswer) {
- afb_request_fail(request, "ERROR", "Can't generate json answer");
+ afb_request_fail(request, "json_answer", "Can't generate json answer");
return;
}