summaryrefslogtreecommitdiff
path: root/ext/ereg
diff options
context:
space:
mode:
authorfoobar <sniper@php.net>2005-07-18 23:17:24 +0000
committerfoobar <sniper@php.net>2005-07-18 23:17:24 +0000
commitdb138c59d4f9e8e5d719ac6744d2ed9645100b99 (patch)
tree9c95a75594a38c1dcd5294df3641c81b0df1979d /ext/ereg
parent936e199d382ffa855546a006cffc498e59c10cd6 (diff)
downloadphp-git-db138c59d4f9e8e5d719ac6744d2ed9645100b99.tar.gz
MFB4_4: Fix compile problem with --regex=system on some systems
Diffstat (limited to 'ext/ereg')
-rw-r--r--ext/ereg/ereg.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/ext/ereg/ereg.c b/ext/ereg/ereg.c
index c8afdc80f9..adad999ee3 100644
--- a/ext/ereg/ereg.c
+++ b/ext/ereg/ereg.c
@@ -46,6 +46,7 @@ static int _php_regcomp(regex_t *preg, const char *pattern, int cflags)
if(zend_hash_find(&REG(ht_rc), (char *) pattern, patlen+1, (void **) &rc) == SUCCESS
&& rc->cflags == cflags) {
+#ifdef HAVE_REGEX_T_RE_MAGIC
/*
* We use a saved magic number to see whether cache is corrupted, and if it
* is, we flush it and compile the pattern from scratch.
@@ -73,7 +74,20 @@ static int _php_regcomp(regex_t *preg, const char *pattern, int cflags)
zend_hash_update(&REG(ht_rc), (char *) pattern, patlen+1,
(void *) &rcp, sizeof(rcp), NULL);
}
-
+#else
+ memcpy(preg, &rc->preg, sizeof(*preg));
+ } else {
+ r = regcomp(preg, pattern, cflags);
+ if(!r) {
+ reg_cache rcp;
+
+ rcp.cflags = cflags;
+ memcpy(&rcp.preg, preg, sizeof(*preg));
+ zend_hash_update(&REG(ht_rc), (char *) pattern, patlen+1,
+ (void *) &rcp, sizeof(rcp), NULL);
+ }
+ }
+#endif
return r;
}
/* }}} */