andrei Mon Jul 18 13:34:39 2005 EDT
Modified files: (Branch: PHP_4_4)
/php-src/ext/standard reg.c
Log:
Use HAVE_REGEX_T_RE_MAGIC to fix compilation problem on systems where
re_magic is not provided publicly.
http://cvs.php.net/diff.php/php-src/ext/standard/reg.c?r1=1.66.2.8&r2=1.66.2.8.2.1&ty=u
Index: php-src/ext/standard/reg.c
diff -u php-src/ext/standard/reg.c:1.66.2.8
php-src/ext/standard/reg.c:1.66.2.8.2.1
--- php-src/ext/standard/reg.c:1.66.2.8 Thu May 26 17:49:04 2005
+++ php-src/ext/standard/reg.c Mon Jul 18 13:34:38 2005
@@ -17,7 +17,7 @@
| Jaakko Hyvätti <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: reg.c,v 1.66.2.8 2005/05/26 21:49:04 andrei Exp $ */
+/* $Id: reg.c,v 1.66.2.8.2.1 2005/07/18 17:34:38 andrei Exp $ */
#include <stdio.h>
#include <ctype.h>
@@ -46,6 +46,7 @@
if(zend_hash_find(®(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 @@
zend_hash_update(®(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(®(ht_rc), (char *) pattern,
patlen+1,
+ (void *) &rcp,
sizeof(rcp), NULL);
+ }
+ }
+#endif
return r;
}
/* }}} */
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php