From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F398DC433F5 for ; Wed, 13 Oct 2021 15:46:14 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 61DFD61163 for ; Wed, 13 Oct 2021 15:46:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 61DFD61163 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 25E70835D7; Wed, 13 Oct 2021 17:46:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="FlbG6QHY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 259E9835C7; Wed, 13 Oct 2021 17:46:07 +0200 (CEST) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 68E6783347 for ; Wed, 13 Oct 2021 17:46:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: by mail.kernel.org (Postfix) with ESMTPSA id CF7BE610CF; Wed, 13 Oct 2021 15:46:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634139961; bh=+e1Z3SGTuxMywEobK8u8Bn2gHVT27BhNMR0PUNiTvCw=; h=From:To:Cc:Subject:Date:From; b=FlbG6QHYcmeZ5J7PYyRqvATRojMzAtRulp+3qiw0dyiWfuOevpgah+FFyaPgnCfTo j4iDeodnZi/YdNxnr2K0iZrzvlqhGL3x8clgjOu5x19YEJmv8D7lf/SlMz7+EROCNc 9i5Ecg/vw431E52Bcfl8tCdSKUoDmtWhf2E0t4KoV1BV9adOo1JGD3+R30990DEDIk +HXwBf+XNJa9GG6Llo+9TORmlchkRgDfpX2FUAskCh9NV6FeP6kxs5RP7kQinkEibY h9foNh3O+YA4NdMT4o9NW8gsIRvGVWnpsq0QkUC7lo9um80PSqzIOjuN1Yc71VImBa dssY0DAEypbYQ== From: =?UTF-8?q?Marek=20Beh=C3=BAn?= To: Simon Glass , Tom Rini Cc: U-Boot Mailing List , =?UTF-8?q?Marek=20Beh=C3=BAn?= Subject: [PATCH v2 00/13] env_get_char() removal and env_get_f() refactor Date: Wed, 13 Oct 2021 17:45:44 +0200 Message-Id: <20211013154557.28479-1-kabel@kernel.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean From: Marek BehĂșn Hi Simon, Tom, env_get_char() is a relic from the past when env was read char-by-char from underlying device. Currently it only accesses in-memory arrays. We can remove it and access the arrays directly. This simplifies the old code of env_get_f(). Changes since v1: - use memcpy() instead of strncpy() when copying value to buffer - fixed a bug in patch adding check to terminating NULL-byte - added patch fixing documentation for env_get_f() - added patch changing behaviour of return value of env_get_f() - some other cosmetic changes Marek Marek BehĂșn (13): env: Fix documentation for env_get_f() env: Drop env_get_char_spec() and old, unused .get_char() implementations examples: api: glue: Remove comment that does not apply anymore env: Change env_match() to static and remove from header env: Don't match empty variable name in env_match() env: Check for terminating null-byte in env_match() env: Inline env_get_char() into it's only user env: Early return from env_get_f() on NULL name env: Use string pointer instead of indexes in env_get_f() env: Use better name for variable in env_get_f() env: Make return value of env_get_f() behave like sprintf() on success env: Use memcpy() instead of ad-hoc code to copy variable value env: Move non-cmd specific env functions to env/common.c cmd/nvedit.c | 188 ------------------------------------------- env/common.c | 190 ++++++++++++++++++++++++++++++++++++++++++++ env/eeprom.c | 18 ----- env/env.c | 13 --- env/nowhere.c | 5 +- env/nvram.c | 14 ---- examples/api/glue.c | 5 -- include/env.h | 24 +----- 8 files changed, 194 insertions(+), 263 deletions(-) -- 2.32.0