summaryrefslogtreecommitdiff
path: root/ext/opcache/zend_shared_alloc.c
diff options
context:
space:
mode:
authorkrakjoe <joe.watkins@live.co.uk>2014-05-05 22:45:29 +0100
committerkrakjoe <joe.watkins@live.co.uk>2014-05-05 22:45:29 +0100
commitd7c529ed327cca4fad2c42fe74fabc367f24dc5b (patch)
tree919d9e6800c6244436ddce9d09d707922fd859a4 /ext/opcache/zend_shared_alloc.c
parent875c48ae679158cb2194c4e277810883e0b21768 (diff)
parent211d32c81429730e2692c65577d021616a525726 (diff)
downloadphp-git-d7c529ed327cca4fad2c42fe74fabc367f24dc5b.tar.gz
Merge branch 'phpng' of git.php.net:php-src into phpng
Diffstat (limited to 'ext/opcache/zend_shared_alloc.c')
-rw-r--r--ext/opcache/zend_shared_alloc.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/ext/opcache/zend_shared_alloc.c b/ext/opcache/zend_shared_alloc.c
index e1a570a3a0..0faabee8b2 100644
--- a/ext/opcache/zend_shared_alloc.c
+++ b/ext/opcache/zend_shared_alloc.c
@@ -325,9 +325,9 @@ void *zend_shared_alloc(size_t size)
int zend_shared_memdup_size(void *source, size_t size)
{
- void **old_p;
+ void *old_p;
- if (zend_hash_index_find(&xlat_table, (ulong)source, (void **)&old_p) == SUCCESS) {
+ if ((old_p = zend_hash_index_find_ptr(&xlat_table, (ulong)source)) != NULL) {
/* we already duplicated this pointer */
return 0;
}
@@ -337,17 +337,17 @@ int zend_shared_memdup_size(void *source, size_t size)
void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source TSRMLS_DC)
{
- void **old_p, *retval;
+ void *old_p, *retval;
- if (zend_hash_index_find(&xlat_table, (ulong)source, (void **)&old_p) == SUCCESS) {
+ if ((old_p = zend_hash_index_find_ptr(&xlat_table, (ulong)source)) != NULL) {
/* we already duplicated this pointer */
- return *old_p;
+ return old_p;
}
retval = ZCG(mem);;
ZCG(mem) = (void*)(((char*)ZCG(mem)) + ZEND_ALIGNED_SIZE(size));
memcpy(retval, source, size);
if (free_source) {
- interned_efree((char*)source);
+ efree(source);
}
zend_shared_alloc_register_xlat_entry(source, retval);
return retval;
@@ -402,7 +402,7 @@ void zend_shared_alloc_lock(TSRMLS_D)
* won't be taken from space which is freed by efree in memdup.
* Otherwise it leads to false matches in memdup check.
*/
- zend_hash_init(&xlat_table, 100, NULL, NULL, 1);
+ zend_hash_init(&xlat_table, 128, NULL, NULL, 1);
}
void zend_shared_alloc_unlock(TSRMLS_D)
@@ -431,17 +431,17 @@ void zend_shared_alloc_clear_xlat_table(void)
void zend_shared_alloc_register_xlat_entry(const void *old, const void *new)
{
- zend_hash_index_update(&xlat_table, (ulong)old, (void*)&new, sizeof(void *), NULL);
+ zend_hash_index_update_ptr(&xlat_table, (ulong)old, (void*)new);
}
void *zend_shared_alloc_get_xlat_entry(const void *old)
{
- void **retval;
+ void *retval;
- if (zend_hash_index_find(&xlat_table, (ulong)old, (void **)&retval) == FAILURE) {
+ if ((retval = zend_hash_index_find_ptr(&xlat_table, (ulong)old)) == NULL) {
return NULL;
}
- return *retval;
+ return retval;
}
size_t zend_shared_alloc_get_free_memory(void)