From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by sourceware.org (Postfix) with ESMTPS id A72C3383A33A for ; Tue, 24 May 2022 13:31:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A72C3383A33A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nefkom.net Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4L6w8j2zvZz1r0mw; Tue, 24 May 2022 15:31:49 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4L6w8j2jvxz1qqkH; Tue, 24 May 2022 15:31:49 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id bJ9065ciS78X; Tue, 24 May 2022 15:31:48 +0200 (CEST) X-Auth-Info: FCmlYTR6tDf2Q/plvzw0NPQSAFRLJF2OjHIRRCeOGbXegnCshnl9RomENjPvA3iJ Received: from igel.home (ppp-46-244-162-0.dynamic.mnet-online.de [46.244.162.0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Tue, 24 May 2022 15:31:48 +0200 (CEST) Received: by igel.home (Postfix, from userid 1000) id 0A2B42C3AC2; Tue, 24 May 2022 15:31:48 +0200 (CEST) From: Andreas Schwab To: Florian Weimer via Libc-alpha Cc: Florian Weimer Subject: Re: [PATCH v2 04/14] locale: Implement struct grouping_iterator References: <99aaabce8a00d64f7d0738c64af3cbd3e7f82c5c.1653314701.git.fweimer@redhat.com> X-Yow: My ELBOW is a remote FRENCH OUTPOST!! Date: Tue, 24 May 2022 15:31:47 +0200 In-Reply-To: <99aaabce8a00d64f7d0738c64af3cbd3e7f82c5c.1653314701.git.fweimer@redhat.com> (Florian Weimer via Libc-alpha's message of "Mon, 23 May 2022 16:07:18 +0200") Message-ID: <87wneboy4c.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2022 13:31:53 -0000 On Mai 23 2022, Florian Weimer via Libc-alpha wrote: > +struct grouping_iterator > +{ > + /* Number of characters in the current group. If this reaches zero, > + a thousands separator needs to be emittted. */ > + size_t remaining_in_current_group; > + > + /* Number of characters remaining in the number. This is used to > + detect the start of the non-repeating groups. */ > + size_t remaining; > + > + /* Points to the current grouping descriptor. */ > + const char *groupings; > + > + /* Total number of characters in the non-repeating groups. */ > + size_t non_repeating_groups; > + > + /* Number of separators that will be inserted if the whole number is > + processed. (Does not change during iteration.) */ > + size_t separators; Does that really need the full range of size_t? I think unsigned int should be enough. > +}; > + > +struct __locale_data; > + > +/* Initializes *IT with the data from LOCDATA (which must be for > + LC_MONETARY or LC_NUMERIC). DIGITS is the length of the number. > + Returns true if grouping is active, false if not. */ > +bool __grouping_iterator_init (struct grouping_iterator *it, > + int category, locale_t loc, > + size_t digits) attribute_hidden; > + > +/* Initializes *IT with no grouping information for a string of length > + DIGITS, and return false to indicate no grouping. */ > +bool __grouping_iterator_init_none (struct grouping_iterator *it, size_t digits) > + attribute_hidden; Similarily, the digits argument can be unsigned int (format string lengths are limited by int anyway). -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."