aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ctl-lib/ctl-action.c2
-rw-r--r--ctl-lib/ctl-config.c14
2 files changed, 7 insertions, 9 deletions
diff --git a/ctl-lib/ctl-action.c b/ctl-lib/ctl-action.c
index cd0fcad..3158500 100644
--- a/ctl-lib/ctl-action.c
+++ b/ctl-lib/ctl-action.c
@@ -233,7 +233,7 @@ PUBLIC CtlActionT *ActionConfig(AFB_ApiT apiHandle, json_object *actionsJ, int e
// action array is close with a nullvalue;
if (json_object_get_type(actionsJ) == json_type_array) {
- int count = json_object_array_length(actionsJ);
+ size_t count = json_object_array_length(actionsJ);
actions = calloc(count + 1, sizeof (CtlActionT));
for (int idx = 0; idx < count; idx++) {
diff --git a/ctl-lib/ctl-config.c b/ctl-lib/ctl-config.c
index 05840f1..09ccf4a 100644
--- a/ctl-lib/ctl-config.c
+++ b/ctl-lib/ctl-config.c
@@ -118,12 +118,10 @@ PUBLIC int CtlConfigExec(AFB_ApiT apiHandle, CtlConfigT *ctlConfig) {
int errcount=0;
for (int idx = 0; ctlConfig->sections[idx].key != NULL; idx++) {
- if (!ctlConfig->sections[idx].actions) {
- AFB_ApiNotice(apiHandle, "CtlConfigLoad: notice empty section '%s'", ctlConfig->sections[idx].key);
- continue;
- }
-
- errcount += ctlConfig->sections[idx].loadCB(apiHandle, &ctlConfig->sections[idx], NULL);
+ if (!ctlConfig->sections[idx].actions)
+ AFB_ApiNotice(apiHandle, "CtlConfigLoad: notice empty section '%s'", ctlConfig->sections[idx].key);
+ else
+ errcount += ctlConfig->sections[idx].loadCB(apiHandle, &ctlConfig->sections[idx], NULL);
}
return errcount;
@@ -187,7 +185,7 @@ json_object* CtlUpdateSectionConfig(AFB_ApiT apiHandle, CtlConfigT *ctlHandle, c
json_object_object_add(ctlHandle->configJ, key, sectionArrayJ);
if (json_object_get_type(filesJ) == json_type_array) {
- int length = json_object_array_length(filesJ);
+ size_t length = json_object_array_length(filesJ);
for (int idx=0; idx < length; idx++) {
json_object *oneFileJ = json_object_array_get_idx(filesJ, idx);
json_object *responseJ = ScanForConfig(CONTROL_CONFIG_PATH ,CTL_SCAN_RECURSIVE, json_object_get_string(oneFileJ), ".json");
@@ -229,7 +227,7 @@ json_object* LoadAdditionalsFiles(AFB_ApiT apiHandle, CtlConfigT *ctlHandle, con
{
json_object *filesJ, *filesArrayJ = json_object_new_array();
if (json_object_get_type(sectionJ) == json_type_array) {
- int length = json_object_array_length(sectionJ);
+ size_t length = json_object_array_length(sectionJ);
for (int idx=0; idx < length; idx++) {
json_object *obj = json_object_array_get_idx(sectionJ, idx);
int hasFiles = json_object_object_get_ex(obj, "files", &filesJ);