From patchwork Thu May 18 07:39:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Osvald X-Patchwork-Id: 763847 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wT3475VmMz9s4q for ; Thu, 18 May 2017 17:39:51 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=sartura-hr.20150623.gappssmtp.com header.i=@sartura-hr.20150623.gappssmtp.com header.b="btLkLu2i"; dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 27994B80934; Thu, 18 May 2017 09:39:43 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP; Thu, 18 May 2017 09:39:43 +0200 (CEST) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id C4F79B8001E for ; Thu, 18 May 2017 09:39:41 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 CL_IP_EQ_HELO_IP=-2 (check from: .sartura. - helo: .mail-wr0-f182.google. - helo-domain: .google.) FROM/MX_MATCHES_HELO(DOMAIN)=-2; rate: -7 Received: from mail-wr0-f182.google.com (mail-wr0-f182.google.com [209.85.128.182]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Thu, 18 May 2017 09:39:40 +0200 (CEST) Received: by mail-wr0-f182.google.com with SMTP id z52so26972732wrc.2 for ; Thu, 18 May 2017 00:39:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sartura-hr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=+IaNtSbFfGAubnw3MBnwmlrmUgMMjUi+wEontHB6zJs=; b=btLkLu2iTqx0U14UEzYotKyxOQfaPTARqq9KA38ntflLI34PRG9bGlRs3MNemHnpsD 575AnLQl09shFqMm5CPXRWZNiub/btCIuiF2PQRCV3AEFjeYc8icXnIWzGEsR4ySWTm3 V0hpRwHik3IGiyBbG6AbEXeDZK7NiUQLbkPPDK+lSVF3zS3PyhJWAUwmeb8Ohq88tn2F 8FUxdJbA6/Sm8PqxoGGv3dGcjv5haj1dRVdcDBzwlLTGo/UWh9mqv4hk1k/53cOAokA4 8e6a89l4r52Am1mTObc78hB6mf+/hSiNpg+aUHTPdhzmzMWS+gkFkQyuJ3e+Fr8WoP2Z cxVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=+IaNtSbFfGAubnw3MBnwmlrmUgMMjUi+wEontHB6zJs=; b=aoGEknelZtuUaiwihi0OANucanK7KZdg6tLGiLHB3AmKoLAAhXYEZK9P7xUhhvarPe OnNr73W+jlj9Cs+yiMWy12iTZahdD4HpTbaAnPjGa4t2fQGnCPTLsL/36Y9/DDb50aT9 WcStriOWBg3GLV1DFfAj6EZmTEeQnXDN0eG9z1zlzNrAoQufF3fdB/w4lo7PJRhgYpwg QJy5RH+lMbgDJsatd2zuLU9l8/YU0POaWQItyAxf2h/y1DpsQtiUoLvcvsLoktpFFntC w0S5MZsKcgf6czW4iRYElJXda87IOQCC3KcGE3hExPz1YwAb02MwKTbpnb9IxksGZG6X x2RQ== X-Gm-Message-State: AODbwcDrM2Pai7GJwHCIJMhTrPndcW8tSktgZM79IpGomMrNJ1HipeX/ 1rxZNySYWrtxSG4b X-Received: by 10.223.164.198 with SMTP id h6mr1747496wrb.44.1495093180115; Thu, 18 May 2017 00:39:40 -0700 (PDT) Received: from localhost.localdomain (cpe-94-253-227-252.st.cable.xnet.hr. [94.253.227.252]) by smtp.gmail.com with ESMTPSA id q16sm5639106wmg.2.2017.05.18.00.39.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 May 2017 00:39:39 -0700 (PDT) From: Denis Osvald To: lede-dev@lists.infradead.org, openwrt-devel@lists.openwrt.org Date: Thu, 18 May 2017 09:39:28 +0200 Message-Id: <20170518073928.22437-1-denis.osvald@sartura.hr> X-Mailer: git-send-email 2.12.0 Subject: [OpenWrt-Devel] [PATCH libubox] json_script: enable custom expr handler callback X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" 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 --- 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; }