From patchwork Sun Apr 23 00:55:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ahelenia_Ziemia=C5=84ska?= X-Patchwork-Id: 68175 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 74D703857722 for ; Sun, 23 Apr 2023 00:55:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 74D703857722 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1682211341; bh=/+JVyB8dGw+13LCr8LXg/dFRSKSeuIoCHcn43Z3LhUs=; h=Date:Cc:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=fosDwtIVnBfTCa6c10abdypEeVLleGc1WGP0oEvQaDtFEXuX2rxxfQML4NNSRQcbq Lk5X/xC3aC3Xm59N1q5In501cFue53BB/FgSe7jg3Yp4YOVVX09wT8CoLsFn7c62Zu 0RgIZGVVGHXEIFCv5NmQBZJz950BqxVFJJfWt8+4= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from tarta.nabijaczleweli.xyz (unknown [139.28.40.42]) by sourceware.org (Postfix) with ESMTP id 02DF63858C74 for ; Sun, 23 Apr 2023 00:55:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 02DF63858C74 Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id DDE3168A0 for ; Sun, 23 Apr 2023 02:55:06 +0200 (CEST) Date: Sun, 23 Apr 2023 02:55:05 +0200 Cc: libc-alpha@sourceware.org Subject: [PATCH] Fix regex type usage Message-ID: MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20230407 X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_INFOUSMEBIZ, MISSING_HEADERS, RDNS_DYNAMIC, SPF_HELO_PASS, 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-Patchwork-Original-From: =?utf-8?b?0L3QsNCxIHZpYSBMaWJjLWFscGhh?= From: =?utf-8?q?Ahelenia_Ziemia=C5=84ska?= Reply-To: =?utf-8?b?0L3QsNCx?= Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" 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 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,