summaryrefslogtreecommitdiff
path: root/ext/ereg
diff options
context:
space:
mode:
authorSascha Schumann <sas@php.net>1999-11-13 16:51:33 +0000
committerSascha Schumann <sas@php.net>1999-11-13 16:51:33 +0000
commitbcb2214e9951b271d073314870bf09a6a87435f5 (patch)
treeb3a1540deb25e4480d62c57854ba092479191e28 /ext/ereg
parentc166a6fb835c5b43a782da141c1543e8a1878229 (diff)
downloadphp-git-bcb2214e9951b271d073314870bf09a6a87435f5.tar.gz
Improve regex library selection. It lets user specify whether they want
system, apache, or php's regex library by using the --with-regex option. "php" is the default; if you use --with-apache in combination with Apache 1.3.x, the default is "apache".
Diffstat (limited to 'ext/ereg')
-rw-r--r--ext/ereg/ereg.c2
-rw-r--r--ext/ereg/php_regex.h4
-rw-r--r--ext/ereg/regex/regex_extra.h14
-rw-r--r--ext/ereg/regex/utils.h3
4 files changed, 21 insertions, 2 deletions
diff --git a/ext/ereg/ereg.c b/ext/ereg/ereg.c
index 7f50ce3170..bd40cb2191 100644
--- a/ext/ereg/ereg.c
+++ b/ext/ereg/ereg.c
@@ -92,7 +92,9 @@ static int _free_reg_cache(reg_cache *rc)
return 1;
}
+#undef regfree
#define regfree(a);
+#undef regcomp
#define regcomp(a,b,c) _php_regcomp(a,b,c)
static void php_reg_init_globals(php_reg_globals *reg_globals)
diff --git a/ext/ereg/php_regex.h b/ext/ereg/php_regex.h
index 46618379af..91cbd994c4 100644
--- a/ext/ereg/php_regex.h
+++ b/ext/ereg/php_regex.h
@@ -1,7 +1,7 @@
#ifndef _PHP_REGEX_H
#define _PHP_REGEX_H
-#if REGEX
+#if REGEX == 1
#include "regex/regex.h"
#ifndef _REGEX_H
#define _REGEX_H 1 /* this should stop Apache from loading the system version of regex.h */
@@ -18,7 +18,7 @@
#ifndef _H_REGEX
#define _H_REGEX 1 /* This one is for AIX */
#endif
-#else
+#elif REGEX == 0
#include <regex.h>
#endif
diff --git a/ext/ereg/regex/regex_extra.h b/ext/ereg/regex/regex_extra.h
new file mode 100644
index 0000000000..b839ddc2ad
--- /dev/null
+++ b/ext/ereg/regex/regex_extra.h
@@ -0,0 +1,14 @@
+
+#undef regexec
+#undef regerror
+#undef regfree
+#undef regcomp
+
+#if (defined(REGEX) && REGEX == 1) || (!defined(REGEX))
+
+#define regexec php_regexec
+#define regerror php_regerror
+#define regfree php_regfree
+#define regcomp php_regcomp
+
+#endif
diff --git a/ext/ereg/regex/utils.h b/ext/ereg/regex/utils.h
index 1a997ac8fc..cd4a96025f 100644
--- a/ext/ereg/regex/utils.h
+++ b/ext/ereg/regex/utils.h
@@ -1,4 +1,7 @@
/* utility definitions */
+
+#include "regex_extra.h"
+
#ifdef _POSIX2_RE_DUP_MAX
#define DUPMAX _POSIX2_RE_DUP_MAX
#else