aboutsummaryrefslogtreecommitdiffstats
path: root/ctl-lib/ctl-action.c
diff options
context:
space:
mode:
Diffstat (limited to 'ctl-lib/ctl-action.c')
-rw-r--r--ctl-lib/ctl-action.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/ctl-lib/ctl-action.c b/ctl-lib/ctl-action.c
index 8aa5dc7..9d71160 100644
--- a/ctl-lib/ctl-action.c
+++ b/ctl-lib/ctl-action.c
@@ -124,7 +124,6 @@ int ActionExecOne(CtlSourceT *source, CtlActionT* action, json_object *queryJ) {
// Direct Request Call in APIV3
-#if (defined(AFB_BINDING_PREV3) || (AFB_BINDING_VERSION == 3))
static void ActionDynRequest(AFB_ReqT request) {
@@ -140,7 +139,6 @@ static void ActionDynRequest(AFB_ReqT request) {
// provide request and execute the action
ActionExecOne(&source, action, queryJ);
}
-#endif
void ParseURI(const char *uri, char **first, char **second)
{
@@ -297,7 +295,7 @@ static int BuildOneAction(AFB_ApiT apiHandle, CtlActionT *action, const char *ur
// unpack individual action object
-int ActionLoadOne(AFB_ApiT apiHandle, CtlActionT *action, json_object *actionJ, int exportApi) {
+int ActionLoadOne_V3(AFB_ApiT apiHandle, CtlActionT *action, json_object *actionJ, int exportApi) {
int err = 0;
const char *uri = NULL;
@@ -312,7 +310,6 @@ int ActionLoadOne(AFB_ApiT apiHandle, CtlActionT *action, json_object *actionJ,
"args", &action->argsJ);
if (!err) {
// in API V3 each control is optionally map to a verb
-#if (defined(AFB_BINDING_PREV3) || (AFB_BINDING_VERSION == 3))
if(!apiHandle)
return -1;
action->api = apiHandle;
@@ -323,7 +320,6 @@ int ActionLoadOne(AFB_ApiT apiHandle, CtlActionT *action, json_object *actionJ,
return -1;
}
}
-#endif
err = BuildOneAction(apiHandle, action, uri);
} else {
AFB_ApiError(apiHandle, "Fail to parse action JSON : (%s)", json_object_to_json_string(actionJ));
@@ -337,7 +333,7 @@ int ActionLoadOne(AFB_ApiT apiHandle, CtlActionT *action, json_object *actionJ,
return err;
}
-CtlActionT *ActionConfig(AFB_ApiT apiHandle, json_object *actionsJ, int exportApi) {
+CtlActionT *ActionConfig_V3(AFB_ApiT apiHandle, json_object *actionsJ, int exportApi) {
int err;
CtlActionT *actions;
@@ -349,14 +345,14 @@ CtlActionT *ActionConfig(AFB_ApiT apiHandle, json_object *actionsJ, int exportAp
for (int idx = 0; idx < count; idx++) {
json_object *actionJ = json_object_array_get_idx(actionsJ, idx);
- err = ActionLoadOne(apiHandle, &actions[idx], actionJ, exportApi);
+ err = ActionLoadOne_V3(apiHandle, &actions[idx], actionJ, exportApi);
if (err)
return NULL;
}
} else {
actions = calloc(2, sizeof (CtlActionT));
- err = ActionLoadOne(apiHandle, &actions[0], actionsJ, exportApi);
+ err = ActionLoadOne_V3(apiHandle, &actions[0], actionsJ, exportApi);
if (err)
return NULL;
}