public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Roland McGrath <roland@redhat.com>,
	Ulrich Drepper <drepper@redhat.com>,
	Isamu Hasegawa <isamu@yamato.ibm.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] RE_ENABLE_I18N in regex_internal.c
Date: Fri, 13 Dec 2002 15:41:00 -0000	[thread overview]
Message-ID: <20021214004115.R1310@sunsite.ms.mff.cuni.cz> (raw)

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  <jakub@redhat.com>

	* posix/regex_internal.c (re_string_context_at): Guard wide char
	code with #ifdef RE_ENABLE_I18N.

2002-11-22  Paolo Bonzini  <bonzini@gnu.org>

	* 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;
+    }
 }
 \f
 /* 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

             reply	other threads:[~2002-12-13 23:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-13 15:41 Jakub Jelinek [this message]
2002-12-13 15:48 ` Roland McGrath

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021214004115.R1310@sunsite.ms.mff.cuni.cz \
    --to=jakub@redhat.com \
    --cc=drepper@redhat.com \
    --cc=isamu@yamato.ibm.com \
    --cc=libc-hacker@sources.redhat.com \
    --cc=roland@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).