cvs: php4 /ext/standard array.c php_array.h
| From: | Andrei Zmievski | Date: | Mon, 11 Dec 2000 05:36:24 +0000 |
| Subject: | cvs: php4 /ext/standard array.c php_array.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-3065@lists.php.net to get a copy of this message | ||
andrei Sun Dec 10 21:36:24 2000 EDT
Modified files:
/php4/ext/standard array.c php_array.h
Log:
Make php_array_merge() an API function.
Index: php4/ext/standard/array.c
diff -u php4/ext/standard/array.c:1.83 php4/ext/standard/array.c:1.84
--- php4/ext/standard/array.c:1.83 Mon Nov 27 05:31:21 2000
+++ php4/ext/standard/array.c Sun Dec 10 21:36:24 2000
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: array.c,v 1.83 2000/11/27 13:31:21 sas Exp $ */
+/* $Id: array.c,v 1.84 2000/12/11 05:36:24 andrei Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -1796,7 +1796,7 @@
/* }}} */
-static void php_array_merge_impl(HashTable *dest, HashTable *src, int recursive)
+PHPAPI void php_array_merge(HashTable *dest, HashTable *src, int recursive)
{
zval **src_entry,
**dest_entry;
@@ -1812,8 +1812,8 @@
(void **)&dest_entry) == SUCCESS) {
convert_to_array_ex(dest_entry);
convert_to_array_ex(src_entry);
- php_array_merge_impl(Z_ARRVAL_PP(dest_entry),
- Z_ARRVAL_PP(src_entry), recursive);
+ php_array_merge(Z_ARRVAL_PP(dest_entry),
+ Z_ARRVAL_PP(src_entry), recursive);
} else {
(*src_entry)->refcount++;
@@ -1833,7 +1833,7 @@
}
}
-static void php_array_merge(INTERNAL_FUNCTION_PARAMETERS, int recursive)
+static void php_array_merge_wrapper(INTERNAL_FUNCTION_PARAMETERS, int recursive)
{
zval ***args = NULL;
int argc,
@@ -1856,7 +1856,7 @@
for (i=0; i<argc; i++) {
convert_to_array_ex(args[i]);
- php_array_merge_impl(Z_ARRVAL_P(return_value), Z_ARRVAL_PP(args[i]), recursive);
+ php_array_merge(Z_ARRVAL_P(return_value), Z_ARRVAL_PP(args[i]), recursive);
}
efree(args);
@@ -1867,7 +1867,7 @@
Merges elements from passed arrays into one array */
PHP_FUNCTION(array_merge)
{
- php_array_merge(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
+ php_array_merge_wrapper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
/* }}} */
@@ -1876,7 +1876,7 @@
Recursively merges elements from passed arrays into one array */
PHP_FUNCTION(array_merge_recursive)
{
- php_array_merge(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
+ php_array_merge_wrapper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
}
/* }}} */
Index: php4/ext/standard/php_array.h
diff -u php4/ext/standard/php_array.h:1.17 php4/ext/standard/php_array.h:1.18
--- php4/ext/standard/php_array.h:1.17 Wed Oct 25 10:40:10 2000
+++ php4/ext/standard/php_array.h Sun Dec 10 21:36:24 2000
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_array.h,v 1.17 2000/10/25 17:40:10 andrei Exp $ */
+/* $Id: php_array.h,v 1.18 2000/12/11 05:36:24 andrei Exp $ */
#ifndef PHP_ARRAY_H
#define PHP_ARRAY_H
@@ -75,6 +75,7 @@
PHP_FUNCTION(array_sum);
HashTable* php_splice(HashTable *, int, int, zval ***, int, HashTable **);
+PHPAPI void php_array_merge(HashTable *dest, HashTable *src, int recursive);
int multisort_compare(const void *a, const void *b);
typedef struct {