diff options
author | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2018-06-08 10:45:20 +0200 |
---|---|---|
committer | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2018-10-08 15:52:51 +0200 |
commit | b55d3b5dfeb0a4dc2495290cf15fab8386bd9e9d (patch) | |
tree | bf8e9c9beb4102454f3d4d22698cf5fcb59eabca /4a-hal | |
parent | 19e10aecc2c79da8a738d6071a74409d6627018c (diff) |
Change the way to handle app fw error
Change the way to handle app fw error by passing adresses of 'char *'
instead of a 'char **'.
Change-Id: I5e89efcf8db113103776f7dc3e40615dc874f400
Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to '4a-hal')
-rw-r--r-- | 4a-hal/4a-hal-utilities/4a-hal-utilities-appfw-responses-handler.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/4a-hal/4a-hal-utilities/4a-hal-utilities-appfw-responses-handler.c b/4a-hal/4a-hal-utilities/4a-hal-utilities-appfw-responses-handler.c index bb12119..590c7c5 100644 --- a/4a-hal/4a-hal-utilities/4a-hal-utilities-appfw-responses-handler.c +++ b/4a-hal/4a-hal-utilities/4a-hal-utilities-appfw-responses-handler.c @@ -79,18 +79,18 @@ enum CallError HalUtlHandleAppFwCallError(AFB_ApiT apiHandle, char *apiCalled, c *returnedInfo = (char *) json_object_get_string(returnedInfoJ); AFB_ApiWarning(apiHandle, - "Api %s and verb %s found, but this error was raised : '%s' with this info : '%s'", - apiCalled, - verbCalled, - *returnedStatus, - *returnedInfo); + "Api %s and verb %s found, but this error was raised : '%s' with this info : '%s'", + apiCalled, + verbCalled, + *returnedStatus, + *returnedInfo); return CALL_ERROR_RETURNED; } void HalUtlHandleAppFwCallErrorInRequest(AFB_ReqT request, char *apiCalled, char *verbCalled, json_object *callReturnJ, char *errorStatusToSend) { - char **returnedStatus, **returnedInfo; + char *returnedStatus = NULL, *returnedInfo = NULL; AFB_ApiT apiHandle; @@ -105,10 +105,7 @@ void HalUtlHandleAppFwCallErrorInRequest(AFB_ReqT request, char *apiCalled, char return; } - returnedStatus = alloca(sizeof(char *)); - returnedInfo = alloca(sizeof(char *)); - - switch (HalUtlHandleAppFwCallError(apiHandle, apiCalled, verbCalled, callReturnJ, returnedStatus, returnedInfo)) { + switch(HalUtlHandleAppFwCallError(apiHandle, apiCalled, verbCalled, callReturnJ, &returnedStatus, &returnedInfo)) { case CALL_ERROR_REQUEST_UNAVAILABLE: case CALL_ERROR_REQUEST_NOT_VALID: case CALL_ERROR_REQUEST_STATUS_UNAVAILABLE: @@ -132,8 +129,8 @@ void HalUtlHandleAppFwCallErrorInRequest(AFB_ReqT request, char *apiCalled, char "Api %s and verb %s found, but this error was raised : '%s' with this info : '%s'", apiCalled, verbCalled, - *returnedStatus, - *returnedInfo); + returnedStatus ? returnedStatus : "not returned", + returnedInfo ? returnedInfo : "not returned"); return; case CALL_ERROR_INVALID_ARGS: |