diff options
author | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2019-04-18 16:25:24 +0200 |
---|---|---|
committer | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2019-05-24 16:28:53 +0200 |
commit | 9cb51ee3170262d8720d47708f483b4b38fd38e6 (patch) | |
tree | f4bf3940f3da01dd8e5f141becb97f96b074c33c /lib/4a-hal-utilities/4a-hal-utilities-hal-streams-handler.c | |
parent | be68761ad6b10555ce410f1f0e42976014f7b259 (diff) |
Normalize coding style among repository
Normalize coding style among project :
- When possible, set the variable outside test in 'if' statement.
- Remove fanciful returns.
- Split too long lines.
- Remove unnecessary '\n' into prints.
- Normalize use of tabulation.
- Use 'afb_req_fail' instead of 'afb_req_fail_f' when possible.
- Add some error prints.
BUG-AGL: SPEC-2329
Change-Id: I14867e05e02b4c4c0389108c335fec2d2aa27495
Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to 'lib/4a-hal-utilities/4a-hal-utilities-hal-streams-handler.c')
-rw-r--r-- | lib/4a-hal-utilities/4a-hal-utilities-hal-streams-handler.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/4a-hal-utilities/4a-hal-utilities-hal-streams-handler.c b/lib/4a-hal-utilities/4a-hal-utilities-hal-streams-handler.c index ed06b27..2960537 100644 --- a/lib/4a-hal-utilities/4a-hal-utilities-hal-streams-handler.c +++ b/lib/4a-hal-utilities/4a-hal-utilities-hal-streams-handler.c @@ -45,23 +45,26 @@ void HalUtlActionOnMixer(afb_req_t request, enum ActionOnMixerType actionType) json_object *requestJson, *responseJ = NULL, *toReturnJ = NULL; - if(! (apiHandle = afb_req_get_api(request))) { - afb_req_fail(request, "api_handle", "Can't get current hal controller api handle"); + apiHandle = afb_req_get_api(request); + if(! apiHandle) { + afb_req_fail(request, "api_handle", "Can't get current hal api handle"); return; } - if(! (ctrlConfig = (CtlConfigT *) afb_api_get_userdata(apiHandle))) { - afb_req_fail(request, "hal_controller_config", "Can't get current hal controller config"); + ctrlConfig = (CtlConfigT *) afb_api_get_userdata(apiHandle); + if(! ctrlConfig) { + afb_req_fail(request, "hal_controller_config", "Can't get current internal hal controller config"); return; } currentHalData = (struct HalData *) getExternalData(ctrlConfig); if(! currentHalData) { - afb_req_fail(request, "hal_controller_data", "Can't get current hal controller data"); + afb_req_fail(request, "hal_controller_data", "Can't get current internal hal controller data"); return; } - if(! (requestJson = afb_req_json(request))) { + requestJson = afb_req_json(request); + if(! requestJson) { afb_req_fail(request, "request_json", "Can't get request json"); return; } @@ -261,14 +264,15 @@ struct InternalHalMixerData *HalUtlAddStreamDataAndCreateStreamVerb(afb_api_t ap createdStreamData->verbToCall = strdup(verbToCall); createdStreamData->streamCardId = strdup(streamCardId); - if((! createdStreamData->verb) || - (! createdStreamData->verbToCall) || - (! createdStreamData->streamCardId)) { + if(! createdStreamData->verb || + ! createdStreamData->verbToCall || + ! createdStreamData->streamCardId) { HalUtlRemoveSelectedMixerData(¤tHalData->internalHalData->streamsData, createdStreamData); return NULL; } - if(! (createdStreamData->event = afb_api_make_event(apiHandle, createdStreamData->verb))) { + createdStreamData->event = afb_api_make_event(apiHandle, createdStreamData->verb); + if(! createdStreamData->event) { HalUtlRemoveSelectedMixerData(¤tHalData->internalHalData->streamsData, createdStreamData); return NULL; } |