From patchwork Mon Feb 22 22:47:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Ponomarev X-Patchwork-Id: 1443334 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=q4725gIf; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=VWmktnVO; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dky7k3gNVz9sS8 for ; Tue, 23 Feb 2021 09:50:26 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=9h20Pk2d2apPfMvM8IPTsTOAlHSaO3EQpXgTGrZZPWE=; b=q4725gIfF1lfkNIx2PTB9U9jnm TIVqF0rVGTO32ZNp3xd6x2YVTLz8xSa3NC276c71jabP17UluWFTXckHHVjJ/bSe8ALxksoqaOGcy JzGppyQQOSMs94HygdkiRYq2f8Ru7hZ3236u81cBM5qTCsf/JUsp+3F7Ew4la2ErNzuompylJtnVE inIa7d9uQwx0jQ/WSI0P0tgcTFyJaaqr+S/z9hGWlhr5raXGGxvRGocRVJH4aF8xREjJyK37Humcs IDBLg+2NrUOSdKUXOvIrdA0t2FMIIapDwT5ROojPWNEk5zUAEzkew/8ph30o8bPJPmvEpf8icrkT+ NYNAhCcg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lEK0E-0000Mo-6e; Mon, 22 Feb 2021 22:48:30 +0000 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lEK0A-0000L0-Ph for openwrt-devel@lists.openwrt.org; Mon, 22 Feb 2021 22:48:28 +0000 Received: by mail-ed1-x52f.google.com with SMTP id n1so23963776edv.2 for ; Mon, 22 Feb 2021 14:48:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+kc86dcCcY42kGvMt0wzR5cvcs7Q1YxTQVuuv9fqGh0=; b=VWmktnVOQSTMvkMsLB1NEHvOVeh6tFOaqnX0BrSfBT9XRkurWo9zh7VAkL3/ZiLwmm XVRBSRw81vUi7H0p0QpqpvJXb/WkAzNCUofgZdFxQd6Kag/BT+HsOFNm32wwWtzZgwxS vYZZjQSdqXdHZtNBt0IbcEWxgrsTkEWTdmx35JiaEysZkh5VEIow8uy9nf5RKJqH9d5f h271zbFiYYZVxTSr+Q/JOVU1v3wQTJ+yND6qYH5bhvbfKm/JHlJCPBKF0+9Qg88zFuzC +DmbJZcT8mXQrNZRMVnCE3voHyREIxmy+zDRcwUmt+LnrH9X/XK2ut6kYyOlZbbjMfWG HRtw== 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:mime-version :content-transfer-encoding; bh=+kc86dcCcY42kGvMt0wzR5cvcs7Q1YxTQVuuv9fqGh0=; b=BaTsbGSRPVZ6U5s4No5aXfmsvojfIEgwos14MyfzvX2O08aMu1IAgcx6UB3xoit9oo mh1AQUKoVtAI82Msp61MtluB1KDMVrqUhRFkGfWgWGBlDk+CxfU4/b259+pvmCpFQ13Z T7nu5lhNuGTnH1m8ThRxNqn8ngWN2pEW0K/4IxPHj7iTkDQIkLAGQRWWeqBXvBd3p8Qv JoWYuGhHNMl40/4uSBBFL+eK7PRE4ICxzq4thfwtgcSzouLOu5lAAa+JhS4mvOrfEhcE 03hwX+/co/GLhrZCRYrVJ+asibnMGAE/9z9X3xIuJZBTL7Dn0k88ZnVCEB1UrgQ+AMYy LX4w== X-Gm-Message-State: AOAM533OZjDD6LtOjc2M+81wTdschkkTVbc3uF9/7TXHEuKf/iFylriT pmYV6En8PWJqo9u594liHj1GHOusZkHoBw== X-Google-Smtp-Source: ABdhPJx+e1lh0KYA4P5sa+IBthScFgxksRH7ughPNu6SH1J69+3cgXjQnsRtKpeQEV6ML/6l7iWAPA== X-Received: by 2002:a50:9dc9:: with SMTP id l9mr24900491edk.377.1614034103667; Mon, 22 Feb 2021 14:48:23 -0800 (PST) Received: from localhost.localdomain ([46.98.213.245]) by smtp.gmail.com with ESMTPSA id bn2sm11437918ejb.35.2021.02.22.14.48.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Feb 2021 14:48:22 -0800 (PST) From: Sergey Ponomarev To: openwrt-devel@lists.openwrt.org Subject: [PATCH 0/3] jshn: load envs only on formatting Date: Tue, 23 Feb 2021 00:47:52 +0200 Message-Id: <20210222224755.50742-1-stokito@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210222_174826_857749_8E64E53B X-CRM114-Status: UNSURE ( 9.81 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:52f listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [stokito[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sergey Ponomarev Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org The set of patches simplifies jshn code and improves it's performance. They are small and easy to review. I found that -i and -n options for pretty print aren't used in the jshn.sh script. To minimize space we can make these options enabled on build config or even just remove them. Other platforms haven't any such tools to work with JSON from shell so I decided to try to port jshn to them. So I created a fork https://github.com/stokito/jshn-jsonc that doesn't have a dependency to avl. Instead it uses linkmap from json-c which may work slower resulted binary size is smaller. The goal is to port jshn to as many platforms as possible. Currently I just created Ubuntu PPA package. I'll appretiate any comments and thought on this. Sergey Ponomarev (3): jshn.c: remove old unsupported json lib jshn.c: load envs only when -w jshn.c: write_key_string(): extract var jshn.c | 99 +++++++++++++++++++++++++++++++--------------------------- 1 file changed, 53 insertions(+), 46 deletions(-)