This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
[PATCH] Make regex usable outside libc
- From: "Germana Ricci" <bonzini at gnu dot org>
- To: <libc-alpha at sources dot redhat dot com>
- Date: Fri, 22 Nov 2002 12:28:51 +0100
- Subject: [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