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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id BF811C433FE for ; Wed, 19 Jan 2022 15:11:23 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3875A830B3; Wed, 19 Jan 2022 16:11:21 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com 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=konsulko.com header.i=@konsulko.com header.b="Mjrb/84a"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BF3EE83102; Wed, 19 Jan 2022 16:11:19 +0100 (CET) Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) (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 521FE8309D for ; Wed, 19 Jan 2022 16:11:16 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qk1-x735.google.com with SMTP id u3so3008402qku.1 for ; Wed, 19 Jan 2022 07:11:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=IlRvfq6RmKDnHjwhpPcUDM/bCZKKhoMeKL7Bn0q4iLA=; b=Mjrb/84aye+erLZjuBn8/wb8OcaYqm6OSN/wFqVytX7Re+eFohF+9Pc8ZtKz5ButR/ o2mDwan78F9Y5rTZmI6wMembapfJ+wXBFBAkh6OEqeojM4SkR+o2goAQuzMSlCdSaYw3 8nxAedM5UvXfCjMvLJiNIUq1dPgF0UB0ivUco= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=IlRvfq6RmKDnHjwhpPcUDM/bCZKKhoMeKL7Bn0q4iLA=; b=IHUjBEF/2P+hoGGmbLMuvuNUN5c/vCARjLbxFEGaD3jMOix698g5AhfJ4nV2ylkzmk cXEwFwsYALdtc1x79IpLgEGKZmgfcR+Dh3cGfcdFNLC++JHvCN9kXgvjkLZALuFqJQtQ rbrqeWVu8aLUneM9lL3sQ6dK7sbloi3LH2qAx3XofqmS18ImgDo42Q5oc12XDrH0iDeD gTV0K9TLMHF0aqRGBkyIsFrC0kDSY3UkqH2hIWlyrG4hsIqKyjnCnthmZW3rgQ4E+vc2 dhkJx51rK2Ov2jmQFq71CX+yzdQFcTrPeBF0ATbl/qw3wUFxRNC0In7Bl2EXWvLYqsud jEHw== X-Gm-Message-State: AOAM530fmQ9PaIzCliWjOUlPxdCG+HGUcsYRhby2rKOj7t9iEmc+nKaH rrFuLfjPbB/F1WAMUkIgelPtfA== X-Google-Smtp-Source: ABdhPJxe8vbfnhZnKH8xqs+KjtbxAyna7D797aBZBB+Tld8pe7qw6OEOfhYpRB5XDD4oNt0N6c0z/A== X-Received: by 2002:a37:640e:: with SMTP id y14mr21716379qkb.707.1642605075072; Wed, 19 Jan 2022 07:11:15 -0800 (PST) Received: from bill-the-cat (2603-6081-7b01-cbda-2ef0-5dff-fedb-a8ba.res6.spectrum.com. [2603:6081:7b01:cbda:2ef0:5dff:fedb:a8ba]) by smtp.gmail.com with ESMTPSA id c19sm482655qte.27.2022.01.19.07.11.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jan 2022 07:11:13 -0800 (PST) Date: Wed, 19 Jan 2022 10:11:11 -0500 From: Tom Rini To: Simon Glass Cc: Heinrich Schuchardt , U-Boot Mailing List , Ilias Apalodimas , Daniel Schwierzeck , Dennis Gilmore , Steffen Jaeckel , Lukas Auer , Michal Simek Subject: Re: [PATCH v3 04/31] lib: Add a way to find the postiion of a trailing number Message-ID: <20220119151111.GB7004@bill-the-cat> References: <20220119014315.1938157-1-sjg@chromium.org> <20220119014315.1938157-5-sjg@chromium.org> <8d8796be-f5ad-15ed-4a03-97519f9c172c@gmx.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="5/uDoXvLw7AC5HRs" Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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 --5/uDoXvLw7AC5HRs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jan 19, 2022 at 07:37:23AM -0700, Simon Glass wrote: > Hi Heinrich, >=20 > On Wed, 19 Jan 2022 at 04:33, Heinrich Schuchardt wr= ote: > > > > On 1/19/22 02:42, Simon Glass wrote: > > > At present it is not possible to find out which part of the string is= the > > > number part and which is before it. Add a new variant which provides = this > > > feature, so we can separate the two in the caller. > > > > > > Signed-off-by: Simon Glass > > > --- > > > > > > Changes in v3: > > > - Change the function to return a pointer to the first digit > > > - Add some tests, including one for 'abc123def456' > > > > > > include/vsprintf.h | 18 ++++++++++++++++++ > > > lib/strto.c | 14 ++++++++++++-- > > > test/str_ut.c | 13 ++++++++++++- > > > 3 files changed, 42 insertions(+), 3 deletions(-) > > > > > > diff --git a/include/vsprintf.h b/include/vsprintf.h > > > index 01d2248e04d..ce7a7aaa1cc 100644 > > > --- a/include/vsprintf.h > > > +++ b/include/vsprintf.h > > > @@ -118,6 +118,24 @@ long trailing_strtol(const char *str); > > > */ > > > long trailing_strtoln(const char *str, const char *end); > > > > > > +/** > > > + * trailing_strtoln_end() - extract trailing integer from a fixed-le= ngth string > > > + * > > > + * Given a fixed-length string this finds a trailing number on the s= tring > > > + * and returns it. For example, "abc123" would return 123. Only the > > > + * characters between @str and @end - 1 are examined. If @end is NUL= L, it is > > > + * set to str + strlen(str). > > > + * > > > + * @str: String to exxamine > > > + * @end: Pointer to end of string to examine, or NULL to use the > > > + * whole string > > > + * @endp: If non-NULL, this is set to point to the character wher= e the > > > + * number starts, e.g. for "mmc0" this would be point to the '0'; = if no > > > + * trailing number is found, it is set to the end of the string > > > + * @return training number if found, else -1 > > > > Return: > > > > https://www.kernel.org/doc/html/latest/doc-guide/kernel-doc.html#functi= on-documentation >=20 > Yes I am slowly getting used to this. >=20 > Is there any way to accept both? U=3DBoot has used @return for years so > there is lots of itin the code. Can we just do a coccinelle script to just update the codebase? --=20 Tom --5/uDoXvLw7AC5HRs Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmHoKg8ACgkQFHw5/5Y0 tyyzQgv/VJEHJ2AnuOEuho/ow20NUhW00RR60jRO6pwhc8mfXhWYdc48DSCwPjrc rFW2TMjT/UjoweFoOsr3Mf5M/5WXED37WiegvZR3ti3I0s3s7Uusszx29XY8mkRw hGEhSDl9le84HkUpvvgecpQQKViPbLrco3UPzeWe66uVM8UKyRUQxZFqM46av7K1 2mk6ymSGNNfajorQGOwlFamB/0nvUpnoasNy4d/baC+eEjifYTBNbs7ESL8c6XQ3 YxTdV3mp56v/SRl9iSgZUVIYB1ZqT2Qat7We3fmtTGYKGGJJem7tgpP2V7Xavrvo jRZ4/MtsczAUogR1I1fkyy5D3Edz9NvpD0pdq2EmJepUAd78hJR7lVIQDEDXahi1 9o69H+nzMMdZYXb4T37lW5HOr0Zu6T1VSPQ6yQMlQJqkEDtcVQgJwGHjwVNNmNVb WEQI7Oe+8OGgy7Oi+rlb7Kx+naJEhTGxpxeKQKkrgUP3VQxN6c0Mx5/6B0BnvwoA mDOuFTMi =otAg -----END PGP SIGNATURE----- --5/uDoXvLw7AC5HRs--