summaryrefslogtreecommitdiff
path: root/ext/standard/array.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2003-08-11 23:16:54 +0000
committerIlia Alshanetsky <iliaa@php.net>2003-08-11 23:16:54 +0000
commited40ae2650b2ea8bf79a40cd12b552ecc0b49ccf (patch)
tree2f37aa775874babc16b82f5c19a3d39165c3accf /ext/standard/array.c
parentf77f977d0ea747686426360cc70466cc4a8b0876 (diff)
downloadphp-git-ed40ae2650b2ea8bf79a40cd12b552ecc0b49ccf.tar.gz
emalloc -> safe_emalloc
Diffstat (limited to 'ext/standard/array.c')
-rw-r--r--ext/standard/array.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 0bcbc782e1..335b4d54a2 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -880,7 +880,7 @@ PHP_FUNCTION(min)
RETURN_FALSE;
}
} else {
- pval ***args = (pval ***) emalloc(sizeof(pval **)*ZEND_NUM_ARGS());
+ pval ***args = (pval ***) safe_emalloc(sizeof(pval **), ZEND_NUM_ARGS(), 0);
pval **min, result;
int i;
@@ -932,7 +932,7 @@ PHP_FUNCTION(max)
RETURN_FALSE;
}
} else {
- pval ***args = (pval ***) emalloc(sizeof(pval **)*ZEND_NUM_ARGS());
+ pval ***args = (pval ***) safe_emalloc(sizeof(pval **), ZEND_NUM_ARGS(), 0);
pval **max, result;
int i;
@@ -1419,7 +1419,7 @@ PHP_FUNCTION(compact)
zval ***args; /* function arguments array */
int i;
- args = (zval ***)emalloc(ZEND_NUM_ARGS() * sizeof(zval **));
+ args = (zval ***)safe_emalloc(ZEND_NUM_ARGS(), sizeof(zval **), 0);
if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
efree(args);
@@ -1643,7 +1643,7 @@ static void array_data_shuffle(zval *array TSRMLS_DC)
return;
}
- elems = (Bucket **)emalloc(n_elems * sizeof(Bucket *));
+ elems = (Bucket **)safe_emalloc(n_elems, sizeof(Bucket *), 0);
hash = Z_ARRVAL_P(array);
n_left = n_elems;
@@ -1818,7 +1818,7 @@ PHP_FUNCTION(array_push)
}
/* Allocate arguments array and get the arguments, checking for errors. */
- args = (zval ***)emalloc(argc * sizeof(zval **));
+ args = (zval ***)safe_emalloc(argc, sizeof(zval **), 0);
if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
efree(args);
WRONG_PARAM_COUNT;
@@ -1947,7 +1947,7 @@ PHP_FUNCTION(array_unshift)
}
/* Allocate arguments array and get the arguments, checking for errors. */
- args = (zval ***)emalloc(argc * sizeof(zval **));
+ args = (zval ***)safe_emalloc(argc, sizeof(zval **), 0);
if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
efree(args);
WRONG_PARAM_COUNT;
@@ -1997,7 +1997,7 @@ PHP_FUNCTION(array_splice)
}
/* Allocate arguments array and get the arguments, checking for errors. */
- args = (zval ***)emalloc(argc * sizeof(zval **));
+ args = (zval ***)safe_emalloc(argc, sizeof(zval **), 0);
if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
efree(args);
WRONG_PARAM_COUNT;
@@ -2026,7 +2026,7 @@ PHP_FUNCTION(array_splice)
/* Create the array of replacement elements */
repl_num = zend_hash_num_elements(Z_ARRVAL_PP(args[3]));
- repl = (zval ***)emalloc(repl_num * sizeof(zval **));
+ repl = (zval ***)safe_emalloc(repl_num, sizeof(zval **), 0);
for (p=Z_ARRVAL_PP(args[3])->pListHead, i=0; p; p=p->pListNext, i++) {
repl[i] = ((zval **)p->pData);
}
@@ -2204,7 +2204,7 @@ static void php_array_merge_wrapper(INTERNAL_FUNCTION_PARAMETERS, int recursive)
}
/* Allocate arguments array and get the arguments, checking for errors. */
- args = (zval ***)emalloc(argc * sizeof(zval **));
+ args = (zval ***)safe_emalloc(argc, sizeof(zval **), 0);
if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
efree(args);
WRONG_PARAM_COUNT;
@@ -2503,7 +2503,7 @@ PHP_FUNCTION(array_pad)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "You may only pad up to 1048576 elements at a time");
RETURN_FALSE;
}
- pads = (zval ***)emalloc(num_pads * sizeof(zval **));
+ pads = (zval ***)safe_emalloc(num_pads, sizeof(zval **), 0);
for (i = 0; i < num_pads; i++) {
pads[i] = pad_value;
}
@@ -2711,14 +2711,14 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior)
WRONG_PARAM_COUNT;
}
/* Allocate arguments array and get the arguments, checking for errors. */
- args = (zval ***)emalloc(argc * sizeof(zval **));
+ args = (zval ***)safe_emalloc(argc, sizeof(zval **), 0);
if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
efree(args);
WRONG_PARAM_COUNT;
}
/* for each argument, create and sort list with pointers to the hash buckets */
- lists = (Bucket ***)emalloc(argc * sizeof(Bucket **));
- ptrs = (Bucket ***)emalloc(argc * sizeof(Bucket **));
+ lists = (Bucket ***)safe_emalloc(argc, sizeof(Bucket **), 0);
+ ptrs = (Bucket ***)safe_emalloc(argc, sizeof(Bucket **), 0);
set_compare_func(SORT_STRING TSRMLS_CC);
for (i=0; i<argc; i++) {
if (Z_TYPE_PP(args[i]) != IS_ARRAY) {
@@ -2868,14 +2868,14 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior)
WRONG_PARAM_COUNT;
}
/* Allocate arguments array and get the arguments, checking for errors. */
- args = (zval ***)emalloc(argc * sizeof(zval **));
+ args = (zval ***)safe_emalloc(argc, sizeof(zval **), 0);
if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
efree(args);
WRONG_PARAM_COUNT;
}
/* for each argument, create and sort list with pointers to the hash buckets */
- lists = (Bucket ***)emalloc(argc * sizeof(Bucket **));
- ptrs = (Bucket ***)emalloc(argc * sizeof(Bucket **));
+ lists = (Bucket ***)safe_emalloc(argc, sizeof(Bucket **), 0);
+ ptrs = (Bucket ***)safe_emalloc(argc, sizeof(Bucket **), 0);
set_compare_func(SORT_STRING TSRMLS_CC);
for (i = 0; i < argc; i++) {
if (Z_TYPE_PP(args[i]) != IS_ARRAY) {
@@ -3061,7 +3061,7 @@ PHP_FUNCTION(array_multisort)
}
/* Allocate arguments array and get the arguments, checking for errors. */
- args = (zval ***)emalloc(argc * sizeof(zval **));
+ args = (zval ***)safe_emalloc(argc, sizeof(zval **), 0);
if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
efree(args);
WRONG_PARAM_COUNT;
@@ -3163,9 +3163,9 @@ PHP_FUNCTION(array_multisort)
* of the input arrays + 1. The last column is NULL to indicate the end
* of the row.
*/
- indirect = (Bucket ***)emalloc(array_size * sizeof(Bucket **));
+ indirect = (Bucket ***)safe_emalloc(array_size, sizeof(Bucket **), 0);
for (i = 0; i < array_size; i++)
- indirect[i] = (Bucket **)emalloc((num_arrays+1) * sizeof(Bucket *));
+ indirect[i] = (Bucket **)safe_emalloc((num_arrays+1), sizeof(Bucket *), 0);
for (i = 0; i < num_arrays; i++) {
k = 0;