diff options
| author | Dmitry Stogov <dmitry@zend.com> | 2014-04-09 09:43:42 +0400 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@zend.com> | 2014-04-09 09:43:42 +0400 |
| commit | 479f520d14ed221765af3ff5a3eb77dc54e1defa (patch) | |
| tree | 30edb1248d6d57e8dddbe9e0b125706db25df771 | |
| parent | 7402af380b3a700dda0e89470770fde15bd56204 (diff) | |
| download | php-git-479f520d14ed221765af3ff5a3eb77dc54e1defa.tar.gz | |
Fixed store of "shared" zend_strings
| -rw-r--r-- | ext/opcache/zend_persist.c | 19 | ||||
| -rw-r--r-- | ext/opcache/zend_shared_alloc.c | 1 |
2 files changed, 15 insertions, 5 deletions
diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c index 20f57525cd..776359e6be 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -34,12 +34,23 @@ _zend_shared_memdup((void*)p, size, 0 TSRMLS_CC) #if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO -# define zend_accel_store_string(str) \ - zend_accel_store(str, sizeof(zend_string) + (str)->len) +# define zend_accel_store_string(str) do { \ + zend_string *new_str = zend_shared_alloc_get_xlat_entry(str); \ + if (new_str) { \ + str = new_str; \ + } else { \ + new_str = _zend_shared_memdup((void*)str, sizeof(zend_string) + (str)->len, 0 TSRMLS_CC); \ + efree(str); \ + str = new_str; \ + } \ + } while (0) # define zend_accel_memdup_string(str) \ zend_accel_memdup(str, sizeof(zend_string) + (str)->len) -# define zend_accel_store_interned_string(str) \ - (IS_ACCEL_INTERNED(str) ? str : zend_accel_store_string(str)) +# define zend_accel_store_interned_string(str) do { \ + if (!IS_ACCEL_INTERNED(str)) { \ + zend_accel_store_string(str); \ + } \ + } while (0) # define zend_accel_memdup_interned_string(str) \ (IS_ACCEL_INTERNED(str) ? str : zend_accel_memdup_string(str)) #else diff --git a/ext/opcache/zend_shared_alloc.c b/ext/opcache/zend_shared_alloc.c index 73f331de6f..4a31d3de6a 100644 --- a/ext/opcache/zend_shared_alloc.c +++ b/ext/opcache/zend_shared_alloc.c @@ -348,7 +348,6 @@ void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source TSRML memcpy(retval, source, size); if (free_source) { efree(source); -//??? interned_efree((char*)source); } zend_shared_alloc_register_xlat_entry(source, retval); return retval; |
