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


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] Make regex usable outside libc


This patch is required to have regex compile when used outside libc.

BTW, Isamu, your patch is great!  It does not work cleanly however because
of two stray START_TIMER/STOP_TIMER left in the source, and because you
forgot to prototype expand_eclosures_sub.

Paolo

2002-11-22  Paolo Bonzini (bonzini@gnu.org)

        * regcomp.c (re_compile_fastmap_iter): __wcrtomb -> wcrtomb
        (regcomp): __re_compile_fastmap -> re_compile_fastmap
        * regex.c: include config.h and define RE_ENABLE_I18N
        if appropriate

diff -rNU3 isamu/regcomp.c mine/regcomp.c
--- isamu/regcomp.c Fri Nov 22 12:04:37 2002
+++ mine/regcomp.c Fri Nov 22 12:04:31 2002
@@ -407,7 +407,7 @@
        char buf[256];
        mbstate_t state;
        memset (&state, '\0', sizeof (state));
-       __wcrtomb (buf, cset->mbchars[i], &state);
+       wcrtomb (buf, cset->mbchars[i], &state);
        re_set_fastmap (fastmap, icase, *(unsigned char *) buf);
      }
  }
@@ -503,7 +503,7 @@
   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.  */
diff -rNU3 isamu/regex.c mine/regex.c
--- isamu/regex.c Fri Nov 22 12:04:37 2002
+++ mine/regex.c Fri Nov 22 12:04:31 2002
@@ -41,6 +41,14 @@
 #  define re_compile_fastmap(bufp) __re_compile_fastmap (bufp)
 #endif

+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#if (HAVE_WCTYPE_H && HAVE_WCHAR_H) || _LIBC
+#define RE_ENABLE_I18N
+#endif
+
 #if _LIBC || __GNUC__ >= 3
 # define BE(expr, val) __builtin_expect (expr, val)
 #else



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