summaryrefslogtreecommitdiffstats
path: root/lib/4a-hal-utilities/4a-hal-utilities-data.c
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2019-04-18 16:25:24 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2019-05-24 16:28:53 +0200
commit9cb51ee3170262d8720d47708f483b4b38fd38e6 (patch)
treef4bf3940f3da01dd8e5f141becb97f96b074c33c /lib/4a-hal-utilities/4a-hal-utilities-data.c
parentbe68761ad6b10555ce410f1f0e42976014f7b259 (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-data.c')
-rw-r--r--lib/4a-hal-utilities/4a-hal-utilities-data.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/lib/4a-hal-utilities/4a-hal-utilities-data.c b/lib/4a-hal-utilities/4a-hal-utilities-data.c
index 314190f..26bbd23 100644
--- a/lib/4a-hal-utilities/4a-hal-utilities-data.c
+++ b/lib/4a-hal-utilities/4a-hal-utilities-data.c
@@ -96,16 +96,14 @@ int8_t HalUtlRemoveSelectedMixerData(struct InternalHalMixerData **mixerDataList
int64_t HalUtlRemoveAllMixerData(struct InternalHalMixerData **mixerDataList)
{
- int8_t ret;
int64_t mixerDataRemoved = 0;
if(! mixerDataList)
return -1;
while(*mixerDataList) {
- ret = HalUtlRemoveSelectedMixerData(mixerDataList, *mixerDataList);
- if(ret)
- return (int64_t) ret;
+ if(HalUtlRemoveSelectedMixerData(mixerDataList, *mixerDataList))
+ return -2;
mixerDataRemoved++;
}
@@ -134,11 +132,10 @@ struct InternalHalMixerData *HalUtlSearchMixerDataByProperties(struct InternalHa
{
struct InternalHalMixerData *currentMixerData;
- if(! mixerDataList || ! verb)
+ if(! mixerDataList || ! *mixerDataList || ! verb)
return NULL;
currentMixerData = *mixerDataList;
-
while(currentMixerData) {
if((! strcmp(verb, currentMixerData->verb)) &&
(! strcmp(verbToCall, currentMixerData->verbToCall)) &&
@@ -152,7 +149,7 @@ struct InternalHalMixerData *HalUtlSearchMixerDataByProperties(struct InternalHa
}
/*******************************************************************************
- * Hal data handling functions *
+ * Hal data handling functions *
******************************************************************************/
struct HalData *HalUtlAddHalToHalList(struct HalData **halDataList)
@@ -233,16 +230,14 @@ int8_t HalUtlRemoveSelectedHalFromList(struct HalData **halDataList, struct HalD
int64_t HalUtlRemoveAllHalFromList(struct HalData **halDataList)
{
- int8_t ret;
int64_t halRemoved = 0;
if(! halDataList)
return -1;
while(*halDataList) {
- ret = HalUtlRemoveSelectedHalFromList(halDataList, *halDataList);
- if(ret)
- return (int64_t) ret;
+ if(HalUtlRemoveSelectedHalFromList(halDataList, *halDataList))
+ return -2;
halRemoved++;
}
@@ -259,7 +254,6 @@ int64_t HalUtlGetNumberOfHalInList(struct HalData **halDataList)
return -1;
currentHalData = *halDataList;
-
while(currentHalData) {
currentHalData = currentHalData->next;
numberOfHal++;
@@ -276,7 +270,6 @@ struct HalData *HalUtlSearchHalDataByApiName(struct HalData **halDataList, char
return NULL;
currentHalData = *halDataList;
-
while(currentHalData) {
if(! strcmp(apiName, currentHalData->apiName))
return currentHalData;
@@ -295,7 +288,6 @@ struct HalData *HalUtlSearchReadyHalDataByCardId(struct HalData **halDataList, i
return NULL;
currentHalData = *halDataList;
-
while(currentHalData) {
if(currentHalData->status == HAL_STATUS_READY && currentHalData->sndCardId == cardId)
return currentHalData;