[LEDE-DEV] [PATCH libubox] json_script: enable custom expr handler callback

Denis Osvald denis.osvald at sartura.hr
Thu May 18 00:39:28 PDT 2017


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 at sartura.hr>
---
 json_script.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/json_script.c b/json_script.c
index 463aac8..8894901 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;
 }
-- 
2.12.0




More information about the Lede-dev mailing list