From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from tiger.tulip.relay.mailchannels.net (tiger.tulip.relay.mailchannels.net [23.83.218.248]) by sourceware.org (Postfix) with ESMTPS id F29033858CDA for ; Wed, 26 Apr 2023 12:28:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F29033858CDA Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 811645C1F9D; Wed, 26 Apr 2023 12:28:23 +0000 (UTC) Received: from pdx1-sub0-mail-a304.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 1ECD85C20ED; Wed, 26 Apr 2023 12:28:23 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1682512103; a=rsa-sha256; cv=none; b=YcyACDdj9ga0X9LTjxVInfPp2SaEHbEzdy4zC94KkcmrqXU55X8DiANd7BXh3r9gaKVVfJ nNfObS3TNKtabfa/X7PkGIIBvz9fyH1d+i8o38vKEHy4zkrvVwNJWaxIPv2H7iNDhsCD16 xVJw7X7Q+B3uyw1MgPyrnOyr+S8T0cvekprGfuxzXd6Qz7gyfWavq+8VmZl1cFMAXYEM5W 1io5gsUjT7qLZTzwKdCthmytFUaRCmcYvgy7wV5PIRJs8uhe1ALtjOQvXTZgrK1leeATaD eC+ds4M3zyWJD7Gq/DUoi06FcOdRF87FU08AgfJmXTqRHsDVqoLCQSJp/UVoKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1682512103; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ha4H6G4G9NjJmTInQMjfCVlWQrOzR1yxqdAsd8dc8Qk=; b=E0RZS/lUbI6zRSVcmP0VjuN+E65Lr3o1oetBNjjclmnOaYMrTQI8cYU2C7wfM7aaDP9wqw KrpOWZQG0S1A3ZVVMjSSlB36UPPyJCUE3t4aBiE54RRbMX2LbgA0oVmFK+sQAga03PXVyW tkD3r76jkEV89OH/WzLYKoMAz6cFh4Bve/+H8Qe9uNlY/01oxDUK30qYZ32ZgrTABu4DJF nb0JJbI2WY5dZXr1R3IE9weAn/gMyL7PLP+SEnDq9W+SgS30/lU/13rVYuaRKaF+enBVh+ uJ18qbWqqPFILJP/jSE1b9NNK/3HGn3stbANYTjQD6Ifa9ntve2uYi6pGaAKXw== ARC-Authentication-Results: i=1; rspamd-548d6c8f77-kmqh4; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Bubble-Bitter: 1e1f9cce436d8f99_1682512103350_1492703928 X-MC-Loop-Signature: 1682512103350:3361396294 X-MC-Ingress-Time: 1682512103350 Received: from pdx1-sub0-mail-a304.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.97.48.108 (trex/6.7.2); Wed, 26 Apr 2023 12:28:23 +0000 Received: from [192.168.0.182] (bras-vprn-toroon4834w-lp130-09-174-91-45-80.dsl.bell.ca [174.91.45.80]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a304.dreamhost.com (Postfix) with ESMTPSA id 4Q5yny5PRbzNn; Wed, 26 Apr 2023 05:28:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gotplt.org; s=dreamhost; t=1682512102; bh=ha4H6G4G9NjJmTInQMjfCVlWQrOzR1yxqdAsd8dc8Qk=; h=Date:Subject:To:Cc:From:Content-Type:Content-Transfer-Encoding; b=s94R7mjZnCZE0ZZWkPvyIwWNgPxtTK7qUfyzNzjnfWUepLE22is1JyUwR4PG+3qBv 9Ommf/aksk6ktu0kEkXIGcVSNTZfg+RG3P4OY7PcTUYK1EtxyhstbxMqLrjjy3yNMp sy0Citgzl6Ic7F+F2RN9TcpQ7KIDJndYXSERj81HcAPuJw8ZnKyqE8lz8T2LehA4hD RE7Vtx6gkFLJ2xMe6mwd7B+fOA7OJH4nKRMIDQM1Y4krnas32q89+lOswmiFPUQybb 57fIBKIBC2Gfq0+CTsZY1GsYYWI100S0uhUIim6WNIvMR2Dt2QefnxF3UFC7t8H6aX C0Cl8tcjddKpA== Message-ID: <1f3d075f-00d2-8f81-02c0-33c99fc9437d@gotplt.org> Date: Wed, 26 Apr 2023 08:28:21 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH] Fix regex type usage Content-Language: en-US To: =?UTF-8?B?0L3QsNCx?= Cc: libc-alpha@sourceware.org References: From: Siddhesh Poyarekar In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3038.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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 List-Id: On 2023-04-22 20:55, наб via Libc-alpha wrote: > include/regex.h had not been updated during the int -> Idx transition, > and the prototypes don't matched the definitions in regexec.c. > > In regcomp.c, most interfaces were updated for Idx, except for two ones > guarded by #if _LIBC. > > Signed-off-by: Ahelenia Ziemiańska > --- LGTM. Reviewed-by: Siddhesh Poyarekar > Please keep me in CC, as I'm not subscribed. > > include/regex.h | 22 +++++++++++----------- > posix/regcomp.c | 8 ++++---- > 2 files changed, 15 insertions(+), 15 deletions(-) > > diff --git a/include/regex.h b/include/regex.h > index 34fb67d855..0ab70a63d4 100644 > --- a/include/regex.h > +++ b/include/regex.h > @@ -11,27 +11,27 @@ extern const char *__re_compile_pattern (const char *pattern, size_t length, > extern int __re_compile_fastmap (struct re_pattern_buffer *buffer) > attribute_hidden; > > -extern int __re_search (struct re_pattern_buffer *buffer, const char *string, > - int length, int start, int range, > +extern regoff_t __re_search (struct re_pattern_buffer *buffer, const char *string, > + regoff_t length, regoff_t start, regoff_t range, > struct re_registers *regs); > > -extern int __re_search_2 > +extern regoff_t __re_search_2 > (struct re_pattern_buffer *buffer, const char *string1, > - int length1, const char *string2, int length2, > - int start, int range, struct re_registers *regs, int stop); > + regoff_t length1, const char *string2, regoff_t length2, > + regoff_t start, regoff_t range, struct re_registers *regs, regoff_t stop); > > -extern int __re_match > +extern regoff_t __re_match > (struct re_pattern_buffer *buffer, const char *string, > - int length, int start, struct re_registers *regs); > + regoff_t length, regoff_t start, struct re_registers *regs); > > -extern int __re_match_2 > +extern regoff_t __re_match_2 > (struct re_pattern_buffer *buffer, const char *string1, > - int length1, const char *string2, int length2, > - int start, struct re_registers *regs, int stop); > + regoff_t length1, const char *string2, regoff_t length2, > + regoff_t start, struct re_registers *regs, regoff_t stop); > > extern void __re_set_registers > (struct re_pattern_buffer *buffer, struct re_registers *regs, > - unsigned num_regs, regoff_t *starts, regoff_t *ends); > + __re_size_t num_regs, regoff_t *starts, regoff_t *ends); > > extern int __regcomp (regex_t *__preg, const char *__pattern, int __cflags); > libc_hidden_proto (__regcomp) > diff --git a/posix/regcomp.c b/posix/regcomp.c > index cbd9bfc673..a928ef6c2d 100644 > --- a/posix/regcomp.c > +++ b/posix/regcomp.c > @@ -2940,7 +2940,7 @@ lookup_collation_sequence_value (bracket_elem_t *br_elem, uint32_t nrules, > > static inline reg_errcode_t > __attribute__ ((always_inline)) > -build_range_exp (bitset_t sbcset, re_charset_t *mbcset, int *range_alloc, > +build_range_exp (bitset_t sbcset, re_charset_t *mbcset, Idx *range_alloc, > bracket_elem_t *start_elem, bracket_elem_t *end_elem, > re_dfa_t *dfa, reg_syntax_t syntax, uint32_t nrules, > const unsigned char *collseqmb, const char *collseqwc, > @@ -2984,7 +2984,7 @@ build_range_exp (bitset_t sbcset, re_charset_t *mbcset, int *range_alloc, > /* There is not enough space, need realloc. */ > uint32_t *new_array_start; > uint32_t *new_array_end; > - int new_nranges; > + Idx new_nranges; > > /* +1 in case of mbcset->nranges is 0. */ > new_nranges = 2 * mbcset->nranges + 1; > @@ -3030,7 +3030,7 @@ build_range_exp (bitset_t sbcset, re_charset_t *mbcset, int *range_alloc, > static inline reg_errcode_t > __attribute__ ((always_inline)) > build_collating_symbol (bitset_t sbcset, re_charset_t *mbcset, > - int *coll_sym_alloc, const unsigned char *name, > + Idx *coll_sym_alloc, const unsigned char *name, > uint32_t nrules, int32_t table_size, > const int32_t *symb_table, const unsigned char *extra) > { > @@ -3063,7 +3063,7 @@ build_collating_symbol (bitset_t sbcset, re_charset_t *mbcset, > { > /* Not enough, realloc it. */ > /* +1 in case of mbcset->ncoll_syms is 0. */ > - int new_coll_sym_alloc = 2 * mbcset->ncoll_syms + 1; > + Idx new_coll_sym_alloc = 2 * mbcset->ncoll_syms + 1; > /* Use realloc since mbcset->coll_syms is NULL > if *alloc == 0. */ > int32_t *new_coll_syms = re_realloc (mbcset->coll_syms, int32_t,