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 A27BEC433F5 for ; Fri, 15 Oct 2021 00:40:49 +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 D7FB9610A0 for ; Fri, 15 Oct 2021 00:40:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D7FB9610A0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.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 D3220837A6; Fri, 15 Oct 2021 02:40:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="BAlosX9U"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 751CC837AE; Fri, 15 Oct 2021 02:40:32 +0200 (CEST) Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D71F1836CB for ; Fri, 15 Oct 2021 02:40:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@google.com Received: by mail-ot1-x32b.google.com with SMTP id l10-20020a056830154a00b00552b74d629aso5547044otp.5 for ; Thu, 14 Oct 2021 17:40:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=ATa5Dyh4NWaopxS5eujBtuA5Ym9E3mdTlwDKCjTgScA=; b=BAlosX9UHViaLs6Xn2QVANGLtcRmE4iA8A1miniQVmZNbr7PoVRNIrEXgtptwmVikG yYT3vR7IqNng1AZlDyCHYv/wrNx8mu9Mk+qpVgazM/Q7b+LaJVyGmBp0BLn6djiSf4mM OzBWzkOpSVzaEbxpYqRLrn1aXO1vcSaGp/3Vw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ATa5Dyh4NWaopxS5eujBtuA5Ym9E3mdTlwDKCjTgScA=; b=KlWqdZfspq97mctZOkHIJWt8HFbjDZt+nUNGGZidW8hN+qDNcKxac8Z9HIDpVhhNRX l8j40YK4d3pLu21HQzBjlwfKAyUCa1bHbBXBI71lqYfmJV5PSaBirAY1Z8D+8P8glT0V 1LiUWNtRGK/njLnCBFnyt3+tkDwrDASseoVB26OlI7IejfgCRlLdz8Ze49a2THqixcLf Ggw2+Mr52QTGcX/1NYMURzPfCWQlAEONjBWLFPt3VssfhtYKZuxEpPICGzBGrYZcjsfU RQvSTACtLvvT9wHdaMlMWuY7SuGC9TVjC5DrZit7xWm0GMWnwTRget5q69U6637YKy+t 9wmQ== X-Gm-Message-State: AOAM532k5kBHGZx+N2YeByta08wl3F9aoO5BwcKCTk0vjCrcngTvWH/R TQTpJ2IV7pLT2y38/4Z31Ga2oNZy4N2DKm7Fx5fSYEkduM0= X-Google-Smtp-Source: ABdhPJzkzloA5HJGRGOEI9CDr1gjmrhZhbpXbEd1XTz2eM/59szysAFpVdYdqJ/tYVY1GiHXlFKNCAE/hJLPg0uBBs8= X-Received: by 2002:a9d:7b49:: with SMTP id f9mr5567322oto.11.1634258421243; Thu, 14 Oct 2021 17:40:21 -0700 (PDT) MIME-Version: 1.0 References: <20211013154557.28479-1-kabel@kernel.org> <20211013154557.28479-11-kabel@kernel.org> In-Reply-To: <20211013154557.28479-11-kabel@kernel.org> From: Simon Glass Date: Thu, 14 Oct 2021 18:40:08 -0600 Message-ID: Subject: Re: [PATCH v2 10/13] env: Use better name for variable in env_get_f() To: =?UTF-8?B?TWFyZWsgQmVow7pu?= Cc: Tom Rini , U-Boot Mailing List , =?UTF-8?B?TWFyZWsgQmVow7pu?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 Hi Marek, On Wed, 13 Oct 2021 at 09:46, Marek Beh=C3=BAn wrote: > > From: Marek Beh=C3=BAn > > The `nxt` variable actually points to the terminating null-byte of the > current env var, and the next env var is at `nxt + 1`, not `nxt`. So a > better name for this variable is `end`. > > Signed-off-by: Marek Beh=C3=BAn > --- > cmd/nvedit.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/cmd/nvedit.c b/cmd/nvedit.c > index 6eabd51209..08288fad10 100644 > --- a/cmd/nvedit.c > +++ b/cmd/nvedit.c > @@ -724,7 +724,7 @@ static const char *matching_name_get_value(const char= *p, const char *name) > */ > int env_get_f(const char *name, char *buf, unsigned len) > { > - const char *env, *p, *nxt; > + const char *env, *p, *end; > > if (name =3D=3D NULL || *name =3D=3D '\0') > return -1; > @@ -734,12 +734,12 @@ int env_get_f(const char *name, char *buf, unsigned= len) > else > env =3D (const char *)gd->env_addr; > > - for (p =3D env; *p !=3D '\0'; p =3D nxt + 1) { > + for (p =3D env; *p !=3D '\0'; p =3D end + 1) { > const char *value; > int n; > > - for (nxt =3D p; *nxt !=3D '\0'; ++nxt) > - if (nxt - env >=3D CONFIG_ENV_SIZE) > + for (end =3D p; *end !=3D '\0'; ++end) > + if (end - env >=3D CONFIG_ENV_SIZE) > return -1; > > value =3D matching_name_get_value(p, name); > -- > 2.32.0 >