aboutsummaryrefslogtreecommitdiffstats
path: root/ctl-lib
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-05-18 13:52:38 +0000
commitfd225ddf14937669a9d7cb38fcfac7463224d514 (patch)
treeb0eac5075c6e8546d5217762dfbcfd2aa488f825 /ctl-lib
parent2b6c0eb7d0df2bf818c439ee51b144a5e8d3216a (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>
Diffstat (limited to 'ctl-lib')
-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++) {