]> granicus.if.org Git - php/commitdiff
- Use ALLOC_ZVAL() in PHP. Finding the places to put FREE_ZVAL(z) is much
authorAndi Gutmans <andi@php.net>
Fri, 24 Dec 1999 15:43:39 +0000 (15:43 +0000)
committerAndi Gutmans <andi@php.net>
Fri, 24 Dec 1999 15:43:39 +0000 (15:43 +0000)
  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
ext/pcre/php_pcre.c
ext/session/session.c
ext/standard/array.c
ext/wddx/wddx.c
sapi/isapi/php4isapi.c

index 72223fbd80c91553a2f51074f95211a63a3e888f..6de2d88784d2305123a31ab9d025ba0878eea205 100644 (file)
@@ -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;
index 865b94924d047afc3e80fcbd52e05fe6f3581c6b..aeaf0bf0df1da3b09df9408a18d9dbdede2aa459 100644 (file)
@@ -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; i<num_subpats; i++) {
-                       match_sets[i] = (zval *)emalloc(sizeof(zval));
+                       match_sets[i] = ALLOC_ZVAL();
                        array_init(match_sets[i]);
                        INIT_PZVAL(match_sets[i]);
                }
@@ -441,7 +441,7 @@ static void _pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global)
                                        }
                                        else {
                                                /* Allocate the result set array */
-                                               result_set = emalloc(sizeof(zval));
+                                               result_set = ALLOC_ZVAL();
                                                array_init(result_set);
                                                INIT_PZVAL(result_set);
                                                
index 26c7097094aac412946721270e849dd731be98fb..ca7df050998237d2ef9c1d1cc83d9162b4e10042 100644 (file)
@@ -176,7 +176,7 @@ static void php_set_session_var(char *name, size_t namelen,
        PLS_FETCH();
        ELS_FETCH();
 
-       state_val_copy = (zval *)emalloc(sizeof(zval));
+       state_val_copy = ALLOC_ZVAL();
        *state_val_copy = *state_val;
        zval_copy_ctor(state_val_copy);
        state_val_copy->refcount = 0;
index a7c7a908e863182393e5b11bdb0f7b3a7cbeafc5..c60f9a6f3650b540be6b1a87a1ff51a223b73e48 100644 (file)
@@ -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);
index 4c34d4c00d4b1b32fb44fa3f9b0c8d9bb6d805b1..d4247efc9ac75db98f6a4e2e6eb3b609c246ab2b 100644 (file)
@@ -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));
index 83416f3ffbf32e582bb19bd9b24eb20cc2e5b6be..489bd627e21e73d2684d122e030e7f82c6d4bd44 100644 (file)
@@ -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++;