From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18581 invoked by alias); 13 Dec 2002 23:41:39 -0000 Mailing-List: contact libc-hacker-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sources.redhat.com Received: (qmail 18565 invoked from network); 13 Dec 2002 23:41:38 -0000 Received: from unknown (HELO sunsite.mff.cuni.cz) (195.113.19.66) by sources.redhat.com with SMTP; 13 Dec 2002 23:41:38 -0000 Received: (from jakub@localhost) by sunsite.mff.cuni.cz (8.11.6/8.11.6) id gBDNfFc21052; Sat, 14 Dec 2002 00:41:15 +0100 Date: Fri, 13 Dec 2002 15:41:00 -0000 From: Jakub Jelinek To: Roland McGrath , Ulrich Drepper , Isamu Hasegawa Cc: Glibc hackers Subject: [PATCH] RE_ENABLE_I18N in regex_internal.c Message-ID: <20021214004115.R1310@sunsite.ms.mff.cuni.cz> Reply-To: Jakub Jelinek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i X-SW-Source: 2002-12/txt/msg00031.txt.bz2 Hi! I wanted to look at bug-regex15.c outside of glibc, unfortunately regex did not compile without RE_ENABLE_I18N (although 99% of places guard uses of it with #ifdef RE_ENABLE_I18N, this one was not). Also, Paolo's regcomp patch is needed too (and it is right for libc too, since regex.c has at the top: #ifdef _LIBC ... # define re_compile_fastmap(bufp) __re_compile_fastmap (bufp) #endif so both __re_compile_fastmap (preg); and re_compile_fastmap (preg); are identical after preprocessing in libc. 2002-12-14 Jakub Jelinek * posix/regex_internal.c (re_string_context_at): Guard wide char code with #ifdef RE_ENABLE_I18N. 2002-11-22 Paolo Bonzini * regcomp.c (regcomp): __re_compile_fastmap -> re_compile_fastmap. --- libc/posix/regex_internal.c.jj 2002-12-10 15:08:49.000000000 +0100 +++ libc/posix/regex_internal.c 2002-12-14 01:55:56.000000000 +0100 @@ -562,14 +562,8 @@ re_string_context_at (input, idx, eflags return ((eflags & REG_NOTEOL) ? CONTEXT_ENDBUF : CONTEXT_NEWLINE | CONTEXT_ENDBUF); } - if (MB_CUR_MAX == 1) - { - c = re_string_byte_at (input, idx); - if (IS_WORD_CHAR (c)) - return CONTEXT_WORD; - return (newline_anchor && IS_NEWLINE (c)) ? CONTEXT_NEWLINE : 0; - } - else +#ifdef RE_ENABLE_I18N + if (MB_CUR_MAX > 1) { wint_t wc; int wc_idx = idx; @@ -588,6 +582,14 @@ re_string_context_at (input, idx, eflags return CONTEXT_WORD; return (newline_anchor && IS_WIDE_NEWLINE (wc)) ? CONTEXT_NEWLINE : 0; } + else +#endif + { + c = re_string_byte_at (input, idx); + if (IS_WORD_CHAR (c)) + return CONTEXT_WORD; + return (newline_anchor && IS_NEWLINE (c)) ? CONTEXT_NEWLINE : 0; + } } /* Functions for set operation. */ --- libc/posix/regcomp.c.jj 2002-12-10 15:08:49.000000000 +0100 +++ libc/posix/regcomp.c 2002-12-14 01:57:19.000000000 +0100 @@ -503,7 +503,7 @@ regcomp (preg, pattern, cflags) if (BE (ret == REG_NOERROR, 1)) /* Compute the fastmap now, since regexec cannot modify the pattern buffer. This function nevers fails in this implementation. */ - (void) __re_compile_fastmap (preg); + (void) re_compile_fastmap (preg); else { /* Some error occurred while compiling the expression. */ Jakub