svn: /pecl/apc/trunk/ apc_string.c
| From: | Gopal Vijayaraghavan | Date: | Wed, 27 Jul 2011 23:35:21 +0000 |
| Subject: | svn: /pecl/apc/trunk/ apc_string.c | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-16098@lists.php.net to get a copy of this message | ||
gopalv Wed, 27 Jul 2011 23:35:21 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=313804
Log:
is_interned_string overrides for php 5.4
Changed paths:
U pecl/apc/trunk/apc_string.c
Modified: pecl/apc/trunk/apc_string.c
===================================================================
--- pecl/apc/trunk/apc_string.c 2011-07-27 23:34:49 UTC (rev 313803)
+++ pecl/apc/trunk/apc_string.c 2011-07-27 23:35:21 UTC (rev 313804)
@@ -49,6 +49,7 @@
static char *old_interned_strings_start;
static char *old_interned_strings_end;
static const char *(*old_new_interned_string)(const char *str, int len, int free_src TSRMLS_DC);
+static zend_bool (*old_is_interned_string)(const char *str TSRMLS_DC);
static void (*old_interned_strings_snapshot)(TSRMLS_D);
static void (*old_interned_strings_restore)(TSRMLS_D);
@@ -126,6 +127,20 @@
return p->arKey;
}
+static zend_bool apc_is_interned_string(const char* s TSRMLS_DC)
+{
+ if((s >= APCSG(interned_strings_start)) &&
+ s < APCSG(interned_strings_end)) {
+ return 1;
+ }
+
+ if(old_is_interned_string) {
+ return old_is_interned_string(s TSRMLS_CC);
+ }
+
+ return 0;
+}
+
static void apc_copy_internal_strings(TSRMLS_D)
{
Bucket *p, *q;
@@ -200,22 +215,22 @@
zend_hash_init(&APCSG(interned_strings), count, NULL, NULL, 1);
APCSG(interned_strings).nTableMask = APCSG(interned_strings).nTableSize - 1;
APCSG(interned_strings).arBuckets = (Bucket**)((char*)apc_interned_strings_data +
sizeof(apc_interned_strings_data_t));
+
+ memset(APCSG(interned_strings).arBuckets, 0,
sizeof(Bucket*)*APCSG(interned_strings).nTableSize);
APCSG(interned_strings_start) = (char*)APCSG(interned_strings).arBuckets +
APCSG(interned_strings).nTableSize * sizeof(Bucket *);
APCSG(interned_strings_end) = (char*)apc_interned_strings_data + APCG(shm_strings_buffer);
APCSG(interned_strings_top) = APCSG(interned_strings_start);
- old_interned_strings_start = CG(interned_strings_start);
- old_interned_strings_end = CG(interned_strings_end);
old_new_interned_string = zend_new_interned_string;
+ old_is_interned_string = zend_is_interned_string;
old_interned_strings_snapshot = zend_interned_strings_snapshot;
old_interned_strings_restore = zend_interned_strings_restore;
- CG(interned_strings_start) = APCSG(interned_strings_start);
- CG(interned_strings_end) = APCSG(interned_strings_end);
zend_new_interned_string = apc_dummy_new_interned_string_for_php;
zend_interned_strings_snapshot = apc_dummy_interned_strings_snapshot_for_php;
zend_interned_strings_restore = apc_dummy_interned_strings_restore_for_php;
+ zend_is_interned_string = apc_is_interned_string;
apc_copy_internal_strings(TSRMLS_C);
}
@@ -226,9 +241,8 @@
zend_hash_clean(CG(class_table));
zend_hash_clean(EG(zend_constants));
- CG(interned_strings_start) = old_interned_strings_start;
- CG(interned_strings_end) = old_interned_strings_end;
zend_new_interned_string = old_new_interned_string;
+ zend_is_interned_string = old_is_interned_string;
zend_interned_strings_snapshot = old_interned_strings_snapshot;
zend_interned_strings_restore = old_interned_strings_restore;