diff options
author | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2018-05-23 20:21:48 +0200 |
---|---|---|
committer | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2018-10-08 15:51:00 +0200 |
commit | 5a2853b996f025b1d331ecbc9c5c136398343f4a (patch) | |
tree | eaec71824885751f3935be89498f510463db48b4 /4a-hal/4a-hal-utilities/4a-hal-utilities-data.c | |
parent | 5fa641b973806749d85e73b7821ac8098d6607f6 (diff) |
Change names of some structures fields
Change names of some structures fields to match the fileds name
in controller structure.
Change-Id: I579ec53835daa010154982539d09d5a2dcbd28b2
Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to '4a-hal/4a-hal-utilities/4a-hal-utilities-data.c')
-rw-r--r-- | 4a-hal/4a-hal-utilities/4a-hal-utilities-data.c | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/4a-hal/4a-hal-utilities/4a-hal-utilities-data.c b/4a-hal/4a-hal-utilities/4a-hal-utilities-data.c index dafed90..11721f2 100644 --- a/4a-hal/4a-hal-utilities/4a-hal-utilities-data.c +++ b/4a-hal/4a-hal-utilities/4a-hal-utilities-data.c @@ -56,7 +56,7 @@ struct SpecificHalData *HalUtlAddHalApiToHalList(struct HalMgrData *HalMgrGlobal currentApi = currentApi->next; } - currentApi->name = NULL; + currentApi->apiName = NULL; currentApi->sndCard = NULL; currentApi->author = NULL; currentApi->version = NULL; @@ -93,8 +93,8 @@ uint8_t HalUtlRemoveSelectedHalFromList(struct HalMgrData *HalMgrGlobalData, str } } - if(matchingApi->name) - free(matchingApi->name); + if(matchingApi->apiName) + free(matchingApi->apiName); if(matchingApi->sndCard) free(matchingApi->sndCard); @@ -147,17 +147,17 @@ uint64_t HalUtlGetNumberOfHalInList(struct HalMgrData *HalMgrGlobalData) return numberOfCtlHal; } -struct SpecificHalData *HalUtlSearchHalDataByApiName(struct HalMgrData *HalMgrGlobalData, char *name) +struct SpecificHalData *HalUtlSearchHalDataByApiName(struct HalMgrData *HalMgrGlobalData, char *apiName) { struct SpecificHalData *currentApi; - if(! HalMgrGlobalData || ! name) + if(! HalMgrGlobalData || ! apiName) return NULL; currentApi = HalMgrGlobalData->first; while(currentApi) { - if(! strcmp(name, currentApi->name)) + if(! strcmp(apiName, currentApi->apiName)) return currentApi; currentApi = currentApi->next; @@ -170,24 +170,20 @@ struct SpecificHalData *HalUtlSearchHalDataByApiName(struct HalMgrData *HalMgrGl * Hal Manager data handling functions * ******************************************************************************/ -uint8_t HalUtlInitializeHalMgrData(afb_dynapi *apiHandle, struct HalMgrData *HalMgrGlobalData, char *name, char *description) +uint8_t HalUtlInitializeHalMgrData(afb_dynapi *apiHandle, struct HalMgrData *HalMgrGlobalData, char *apiName, char *info) { - if(! apiHandle || ! HalMgrGlobalData || ! name || ! description) + if(! apiHandle || ! HalMgrGlobalData || ! apiName || ! info) return -1; - // Allocate name and info strings - HalMgrGlobalData->name = (char *) calloc(strlen(name), sizeof(char)); - if(! HalMgrGlobalData->name) + // Allocate and fill apiName and info strings + HalMgrGlobalData->apiName = strdup(apiName); + if(! HalMgrGlobalData->apiName) return -2; - HalMgrGlobalData->description = (char *) calloc(strlen(description), sizeof(char)); - if(! HalMgrGlobalData->name) + HalMgrGlobalData->info = strdup(info); + if(! HalMgrGlobalData->apiName) return -3; - // Fill HalMgrGlobalData structure - strcpy(HalMgrGlobalData->name, name); - strcpy(HalMgrGlobalData->description, description); - HalMgrGlobalData->apiHandle = apiHandle; return 0; @@ -201,11 +197,11 @@ void HalUtlRemoveHalMgrData(struct HalMgrData *HalMgrGlobalData) if(HalMgrGlobalData->first) HalUtlRemoveAllHalFromList(HalMgrGlobalData); - if(HalMgrGlobalData->name) - free(HalMgrGlobalData->name); + if(HalMgrGlobalData->apiName) + free(HalMgrGlobalData->apiName); - if(HalMgrGlobalData->description) - free(HalMgrGlobalData->description); + if(HalMgrGlobalData->info) + free(HalMgrGlobalData->info); free(HalMgrGlobalData); }
\ No newline at end of file |