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.
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;
}
/* }}} */
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.
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;
}
/* }}} */