public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] RE_ENABLE_I18N in regex_internal.c
@ 2002-12-13 15:41 Jakub Jelinek
  2002-12-13 15:48 ` Roland McGrath
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2002-12-13 15:41 UTC (permalink / raw)
  To: Roland McGrath, Ulrich Drepper, Isamu Hasegawa; +Cc: Glibc hackers

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] RE_ENABLE_I18N in regex_internal.c
  2002-12-13 15:41 [PATCH] RE_ENABLE_I18N in regex_internal.c Jakub Jelinek
@ 2002-12-13 15:48 ` Roland McGrath
  0 siblings, 0 replies; 2+ messages in thread
From: Roland McGrath @ 2002-12-13 15:48 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Ulrich Drepper, Isamu Hasegawa, Glibc hackers

Thanks, I put these in.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-12-13 23:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-13 15:41 [PATCH] RE_ENABLE_I18N in regex_internal.c Jakub Jelinek
2002-12-13 15:48 ` Roland McGrath

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).