From 3f6e00e48ddef5ab2dd73aa093c3654edd6ca534 Mon Sep 17 00:00:00 2001 From: Andi Gutmans Date: Fri, 24 Dec 1999 15:43:39 +0000 Subject: [PATCH] - Use ALLOC_ZVAL() in PHP. Finding the places to put FREE_ZVAL(z) is much more tricky and I'm not sure how many places this is. zval allocations were only made directly in 11 places. --- ext/hyperwave/hw.c | 2 +- ext/pcre/php_pcre.c | 4 ++-- ext/session/session.c | 2 +- ext/standard/array.c | 2 +- ext/wddx/wddx.c | 8 ++++---- sapi/isapi/php4isapi.c | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ext/hyperwave/hw.c b/ext/hyperwave/hw.c index 72223fbd80..6de2d88784 100644 --- a/ext/hyperwave/hw.c +++ b/ext/hyperwave/hw.c @@ -1175,7 +1175,7 @@ php_printf("%s\n", ptr); while(attrname != NULL) { char *name; - user_arr = (zval *) emalloc(sizeof(zval)); + user_arr = ALLOC_ZVAL(); if (array_init(user_arr) == FAILURE) { efree(object); RETURN_FALSE; diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 865b94924d..aeaf0bf0df 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -393,7 +393,7 @@ static void _pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) if (global && subpats_order_val == PREG_PATTERN_ORDER) { match_sets = (zval **)emalloc(num_subpats * sizeof(zval *)); for (i=0; irefcount = 0; diff --git a/ext/standard/array.c b/ext/standard/array.c index a7c7a908e8..c60f9a6f36 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -1059,7 +1059,7 @@ static void _compact_var(HashTable *eg_active_symbol_table, zval *return_value, if (zend_hash_find(eg_active_symbol_table, entry->value.str.val, entry->value.str.len+1, (void **)&value_ptr) != FAILURE) { value = *value_ptr; - data = (zval *)emalloc(sizeof(zval)); + data = ALLOC_ZVAL(); *data = *value; zval_copy_ctor(data); INIT_PZVAL(data); diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index 4c34d4c00d..d4247efc9a 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -468,7 +468,7 @@ static void _php_wddx_push_element(void *user_data, const char *name, const char } else ent.varname = NULL; - ent.data = (zval *)emalloc(sizeof(zval)); + ent.data = ALLOC_ZVAL(); ent.data->value.str.val = NULL; ent.data->value.str.len = 0; INIT_PZVAL(ent.data); @@ -492,7 +492,7 @@ static void _php_wddx_push_element(void *user_data, const char *name, const char } else ent.varname = NULL; - ent.data = (zval *)emalloc(sizeof(zval)); + ent.data = ALLOC_ZVAL(); INIT_PZVAL(ent.data); wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); } else if (!strcmp(name, EL_ARRAY)) { @@ -504,7 +504,7 @@ static void _php_wddx_push_element(void *user_data, const char *name, const char } else ent.varname = NULL; - ent.data = (zval *)emalloc(sizeof(zval)); + ent.data = ALLOC_ZVAL(); array_init(ent.data); INIT_PZVAL(ent.data); wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); @@ -517,7 +517,7 @@ static void _php_wddx_push_element(void *user_data, const char *name, const char } else ent.varname = NULL; - ent.data = (zval *)emalloc(sizeof(zval)); + ent.data = ALLOC_ZVAL(); array_init(ent.data); INIT_PZVAL(ent.data); wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); diff --git a/sapi/isapi/php4isapi.c b/sapi/isapi/php4isapi.c index 83416f3ffb..489bd627e2 100644 --- a/sapi/isapi/php4isapi.c +++ b/sapi/isapi/php4isapi.c @@ -407,7 +407,7 @@ static void hash_isapi_variables(ELS_D SLS_DC) if (colon) { char *value = colon+1; - zval *entry = (zval *) emalloc(sizeof(zval)); + zval *entry = ALLOC_ZVAL(); while (*value==' ') { value++; -- 2.40.0