summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-05-16 01:23:21 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-12-13 15:02:54 +0100
commit9d34c8ec51215ebdde429f406e015073818e3d13 (patch)
treeb0eac5075c6e8546d5217762dfbcfd2aa488f825
parent5643b2a3ea7a5c3454113cd80f5f07251d1c0a4b (diff)
Improve reliability and function calls
Don't calls two times the same function. As well as avoiding using the function return to get its length Change-Id: I26c37f9a376b2c243ffd7a5ad0ddf935c8b5d0e9 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--ctl-lib/ctl-config.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ctl-lib/ctl-config.c b/ctl-lib/ctl-config.c
index 5503db1..cac8c75 100644
--- a/ctl-lib/ctl-config.c
+++ b/ctl-lib/ctl-config.c
@@ -44,8 +44,10 @@ int CtlConfigMagicNew() {
json_object* CtlConfigScan(const char *dirList, const char *prefix) {
char controlFile [CONTROL_MAXPATH_LEN];
+ const char *binderName = GetBinderName();
+
strncpy(controlFile, prefix, strlen(prefix)+1);
- strncat(controlFile, GetBinderName(), strlen(GetBinderName()));
+ strncat(controlFile, binderName, strlen(binderName));
// search for default dispatch config file
json_object* responseJ = ScanForConfig(dirList, CTL_SCAN_RECURSIVE, controlFile, ".json");
@@ -112,7 +114,7 @@ int CtlConfigExec(AFB_ApiT apiHandle, CtlConfigT *ctlConfig) {
// load static LUA utilities
LuaConfigExec(apiHandle);
#endif
-
+
// Loop on every section and process config
int errcount=0;
for (int idx = 0; ctlConfig->sections[idx].key != NULL; idx++) {