This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] RE_ENABLE_I18N in regex_internal.c


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]