com php-src: Avoid reallocations: Zend/zend_object_handlers .c ext/mysqli/mysqli.c ext/pgsql/pgsql.c
| From: | Dmitry Stogov | Date: | Mon, 14 Sep 2015 20:04:27 +0000 |
| Subject: | com php-src: Avoid reallocations: Zend/zend_object_handlers .c ext/mysqli/mysqli.c ext/pgsql/pgsql.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-89017@lists.php.net to get a copy of this message | ||
Commit: 927d68db246c8679bcfcf363eb61ae7b7a9f0dc8
Author: Dmitry Stogov <dmitry@zend.com> Mon, 14 Sep 2015 23:04:27 +0300
Parents: 5c28c21159ca2c41026c5381d9dbf119b8fd6882
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=927d68db246c8679bcfcf363eb61ae7b7a9f0dc8
Log:
Avoid reallocations
Changed paths:
M Zend/zend_object_handlers.c
M ext/mysqli/mysqli.c
M ext/pgsql/pgsql.c
Diff:
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index 76f950b..8587a82 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -168,9 +168,7 @@ ZEND_API HashTable *zend_std_get_debug_info(zval *object, int *is_temp) /* {{{ *
return zend_array_dup(Z_ARRVAL(retval));
} else if (Z_REFCOUNT(retval) <= 1) {
*is_temp = 1;
- ALLOC_HASHTABLE(ht);
- *ht = *Z_ARRVAL(retval);
- efree_size(Z_ARR(retval), sizeof(zend_array));
+ ht = Z_ARR(retval);
return ht;
} else {
*is_temp = 0;
diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c
index 8039244..1c933d9 100644
--- a/ext/mysqli/mysqli.c
+++ b/ext/mysqli/mysqli.c
@@ -1275,9 +1275,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int
override_flags
object_and_properties_init(return_value, ce, NULL);
if (!ce->default_properties_count && !ce->__set) {
- ALLOC_HASHTABLE(Z_OBJ_P(return_value)->properties);
- *Z_OBJ_P(return_value)->properties = *Z_ARRVAL(dataset);
- efree(Z_ARR(dataset));
+ Z_OBJ_P(return_value)->properties = Z_ARR(dataset);
} else {
zend_merge_properties(return_value, Z_ARRVAL(dataset));
zval_ptr_dtor(&dataset);
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 8961508..e8e5a53 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -2781,9 +2781,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long
result_
ZVAL_COPY_VALUE(&dataset, return_value);
object_and_properties_init(return_value, ce, NULL);
if (!ce->default_properties_count && !ce->__set) {
- ALLOC_HASHTABLE(Z_OBJ_P(return_value)->properties);
- *Z_OBJ_P(return_value)->properties = *Z_ARRVAL(dataset);
- efree(Z_ARR(dataset));
+ Z_OBJ_P(return_value)->properties = Z_ARR(dataset);
} else {
zend_merge_properties(return_value, Z_ARRVAL(dataset));
zval_ptr_dtor(&dataset);