]> granicus.if.org Git - php/commitdiff
Simplify the code and use zend_hash_next_index_insert()
authorBen Ramsey <ramsey@php.net>
Sat, 14 Apr 2012 07:39:25 +0000 (02:39 -0500)
committerBen Ramsey <ramsey@php.net>
Fri, 11 Jan 2013 20:16:19 +0000 (14:16 -0600)
ext/standard/array.c

index b707301bd85874f6394d4b53dbeac611e2221eaf..c5d0fa774751a3f2a5b2ae4d9a8e3120cf694d6d 100644 (file)
@@ -2613,31 +2613,8 @@ PHP_FUNCTION(array_column)
                                continue;
                        }
 
-                       switch (Z_TYPE_PP(zvalue)) {
-                               case IS_NULL:
-                                       add_next_index_null(return_value);
-                                       break;
-                               case IS_LONG:
-                                       add_next_index_long(return_value, Z_LVAL_PP(zvalue));
-                                       break;
-                               case IS_DOUBLE:
-                                       add_next_index_double(return_value, Z_DVAL_PP(zvalue));
-                                       break;
-                               case IS_BOOL:
-                                       add_next_index_bool(return_value, Z_BVAL_PP(zvalue));
-                                       break;
-                               case IS_OBJECT:
-                                       zval_add_ref(zvalue);
-                                       add_next_index_zval(return_value, *zvalue);
-                                       break;
-                               case IS_STRING:
-                                       add_next_index_stringl(return_value, Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue), 1);
-                                       break;
-                               case IS_RESOURCE:
-                                       zval_add_ref(zvalue);
-                                       add_next_index_resource(return_value, Z_RESVAL_PP(zvalue));
-                                       break;
-                       }
+                       Z_ADDREF_PP(zvalue);
+                       zend_hash_next_index_insert(HASH_OF(return_value), (void **)zvalue, sizeof(zval *), NULL);
                }
 
        }