Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Osvald <denis.osvald@sartura.hr>2017-05-18 10:39:28 +0300
committerFelix Fietkau <nbd@nbd.name>2017-06-01 12:23:16 +0300
commitfa9937cc4f8e60ddfc2dd9b5820eac49bef3de6e (patch)
treed7dcf9171bdd1bdd15e8de101581226d1387e8fa /json_script.c
parent723730214732862de7e892bae2f7a7889e66bf1b (diff)
json_script: enable custom expr handler callback
This wires in custom expression handler functionality, which was present in json script since the original version, but never used. Signed-off-by: Denis Osvald <denis.osvald@sartura.hr> Signed-off-by: Felix Fietkau <nbd@nbd.name> [error handling fix]
Diffstat (limited to 'json_script.c')
-rw-r--r--json_script.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/json_script.c b/json_script.c
index 463aac8..87b1d71 100644
--- a/json_script.c
+++ b/json_script.c
@@ -415,8 +415,10 @@ static int json_process_expr(struct json_call *call, struct blob_attr *cur)
}
ret = __json_process_type(call, cur, expr, ARRAY_SIZE(expr), &found);
- if (!found)
- ctx->handle_error(ctx, "Unknown expression type", cur);
+ if (!found) {
+ const char *name = blobmsg_data(blobmsg_data(cur));
+ ctx->handle_expr(ctx, name, cur, call->vars);
+ }
return ret;
}
@@ -671,6 +673,7 @@ static int
__default_handle_expr(struct json_script_ctx *ctx, const char *name,
struct blob_attr *expr, struct blob_attr *vars)
{
+ ctx->handle_error(ctx, "Unknown expression type", expr);
return -1;
}