]> granicus.if.org Git - php/commitdiff
- Move more stuff to ALLOC_ZVAL(). We need to add those FREE_ZVAL()'s now.
authorAndi Gutmans <andi@php.net>
Fri, 24 Dec 1999 17:39:27 +0000 (17:39 +0000)
committerAndi Gutmans <andi@php.net>
Fri, 24 Dec 1999 17:39:27 +0000 (17:39 +0000)
12 files changed:
apidoc-zend.txt
ext/dav/dav.c
ext/java/java.c
ext/odbc/php_odbc.c
ext/rpc/com/COM.c
ext/rpc/java/java.c
ext/standard/iptc.c
ext/standard/post.c
ext/standard/var.c
ext/sybase_ct/php_sybase_ct.c
main/main.c
main/rfc1867.c

index 4667ed501a54479bf6ab2dbea473bec13f39af83..1b4a4f7f91d7dff8c6025f6cfad6dec76e181c26 100644 (file)
@@ -64,7 +64,7 @@ php3_write()
 
 php4_write()
 {
-       pval *newval = (pval *) emalloc(sizeof(pval));
+       pval *newval = ALLOC_ZVAL();
 
        newval->refcount=1;
        newval->is_ref=0;
index 4bd40f14f8ff7f9753a3cadacda63d8115d50939..0b520f206a2daea0d1301b5d57650b778baaee3e 100644 (file)
@@ -192,7 +192,7 @@ dav_call_handler(char *funcName, int argc, pval **argv)
                HashTable *function_table;
 
                func = php3i_string_pval(funcName);
-               retval = emalloc(sizeof(pval));
+               retval = ALLOC_ZVAL();
                function_table = php3i_get_function_table();
                if (call_user_function(function_table, NULL, func, retval, argc, argv) == FAILURE) {
                        php3tls_pval_destructor(retval);
index 037e43bdbd0ede464671333c7b094bb96567a7fc..db8188f2c54362bb3eae622ae01d1705c7a91b52 100644 (file)
@@ -500,7 +500,7 @@ JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromObject
     zend_hash_init(presult->value.obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
   };
 
-  handle = (pval *) emalloc(sizeof(pval));
+  handle = ALLOC_ZVAL();
   handle->type = IS_LONG;
   handle->value.lval =
     zend_list_insert((*jenv)->NewGlobalRef(jenv,value), le_jobject);
index b5e3165a4ec956584125a0d360b0556c7f5b0bdf..adde6bce1599aeb156ffd946e19fb4c1919f3e2d 100644 (file)
@@ -1096,7 +1096,7 @@ PHP_FUNCTION(odbc_fetch_into)
                result->fetched++;
 
        for(i = 0; i < result->numcols; i++) {
-               tmp = (pval *) emalloc(sizeof(pval));
+               tmp = ALLOC_ZVAL();
                tmp->refcount = 1;
                tmp->type = IS_STRING;
                tmp->value.str.len = 0;
index d86d5c277019a2ea9d7955594b835904b5e95369..f8659f0f784b7d8c36f9557fd9ae661e8da67fc5 100644 (file)
@@ -416,7 +416,7 @@ static void php_variant_to_pval(VARIANTARG *var_arg, pval *pval_arg, int persist
                        pval_arg->refcount=1;
                        zend_hash_init(pval_arg->value.obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
 
-                       handle = (pval *) emalloc(sizeof(pval));
+                       handle = ALLOC_ZVAL();
                        handle->type = IS_LONG;
                        handle->value.lval = zend_list_insert(var_arg->pdispVal, le_idispatch);
                        pval_copy_constructor(handle);
@@ -915,7 +915,7 @@ void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_r
                        var_reset(object);
                        return;
                }
-               object_handle  = (pval *) emalloc(sizeof(pval));
+               object_handle  = ALLOC_ZVAL();
                *object_handle = *return_value;
                pval_copy_constructor(object_handle);
                INIT_PZVAL(object_handle);
index 037e43bdbd0ede464671333c7b094bb96567a7fc..db8188f2c54362bb3eae622ae01d1705c7a91b52 100644 (file)
@@ -500,7 +500,7 @@ JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromObject
     zend_hash_init(presult->value.obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
   };
 
-  handle = (pval *) emalloc(sizeof(pval));
+  handle = ALLOC_ZVAL();
   handle->type = IS_LONG;
   handle->value.lval =
     zend_list_insert((*jenv)->NewGlobalRef(jenv,value), le_jobject);
index cd6d107f4f42381854839a4f53ecaa4ef59a54c5..64e886faa59de060ada1ea005a91360fadd23ffa 100644 (file)
@@ -356,7 +356,7 @@ PHP_FUNCTION(iptcparse)
                }
 
                if (zend_hash_find(return_value->value.ht,key,strlen(key) + 1,(void **) &element) == FAILURE) {
-                       values = emalloc(sizeof(pval));
+                       values = ALLOC_ZVAL();
                        INIT_PZVAL(values);
                        if (array_init(values) == FAILURE) {
                                php_error(E_ERROR, "Unable to initialize array");
index 4984b8283773ad0105a685d3a781c72e09f5d8aa..b41007239a24c4e751ea05d67bb6725e8a4281fb 100644 (file)
@@ -112,7 +112,7 @@ void php_parse_gpc_data(char *val, char *var, pval *track_vars_array ELS_DC PLS_
                }
 
                /* Create the element */
-               array_element = (pval *) emalloc(sizeof(pval));
+               array_element = ALLOC_ZVAL();
                INIT_PZVAL(array_element);
                array_element->value.str.val = val;
                array_element->value.str.len = val_len;
@@ -315,7 +315,7 @@ void php_treat_data(int arg, char *str ELS_DC PLS_DC SLS_DC)
                case PARSE_GET:
                case PARSE_COOKIE:
                        if (PG(track_vars)) {
-                               array_ptr = (pval *) emalloc(sizeof(pval));
+                               array_ptr = ALLOC_ZVAL();
                                array_init(array_ptr);
                                INIT_PZVAL(array_ptr);
                                switch (arg) {
@@ -369,7 +369,7 @@ void php_treat_data(int arg, char *str ELS_DC PLS_DC SLS_DC)
        if((NULL != SG(request_info).content_type) && (0 == strcmp(SG(request_info).content_type, "application/vnd.fdf"))) {
                pval *tmp;
 
-               tmp = (pval *) emalloc(sizeof(pval));
+               tmp = ALLOC_ZVAL();
                tmp->value.str.len = SG(request_info).post_data_length;
                tmp->value.str.val = estrndup(SG(request_info).post_data, SG(request_info).post_data_length);
                tmp->type = IS_STRING;
index 736971a7241272fd9f2784a5299a081c17b5ca2b..263dfad42ca1e4667ffd51ede650bedb7173bad8 100644 (file)
@@ -96,7 +96,7 @@ void php_var_dump(pval **struc, int level)
                                }
                                switch (i) {
                                        case HASH_KEY_IS_LONG:{
-                                                       pval *d = emalloc(sizeof(pval));
+                                                       pval *d = ALLOC_ZVAL();
 
                                                        d->type = IS_LONG;
                                                        d->value.lval = index;
@@ -106,7 +106,7 @@ void php_var_dump(pval **struc, int level)
                                                break;
 
                                        case HASH_KEY_IS_STRING:{
-                                                       pval *d = emalloc(sizeof(pval));
+                                                       pval *d = ALLOC_ZVAL();
 
                                                        d->type = IS_STRING;
                                                        d->value.str.val = key;
@@ -253,14 +253,14 @@ void php_var_serialize(pval *buf, pval **struc)
 
                                        switch (i) {
                                                case HASH_KEY_IS_LONG:
-                                                       d = emalloc(sizeof(pval));      
+                                                       d = ALLOC_ZVAL();       
                                                        d->type = IS_LONG;
                                                        d->value.lval = index;
                                                        php_var_serialize(buf, &d);
                                                        efree(d);
                                                        break;
                                                case HASH_KEY_IS_STRING:
-                                                       d = emalloc(sizeof(pval));      
+                                                       d = ALLOC_ZVAL();       
                                                        d->type = IS_STRING;
                                                        d->value.str.val = key;
                                                        d->value.str.len = strlen(key);
@@ -431,8 +431,8 @@ int php_var_unserialize(pval **rval, const char **p, const char *max)
                                return 0;
                        }
                        for ((*p) += 2; **p && **p != '}' && i > 0; i--) {
-                               pval *key = emalloc(sizeof(pval));
-                               pval *data = emalloc(sizeof(pval));
+                               pval *key = ALLOC_ZVAL();
+                               pval *data = ALLOC_ZVAL();
                                
                                if (!php_var_unserialize(&key, p, max)) {
                                  zval_dtor(key);
index 201156e06ea237bf7b02b9fad15f27df8f2dafa4..d241e9a21c85f56b7db3d0a7215759ecee88f4cc 100644 (file)
@@ -1224,7 +1224,7 @@ PHP_FUNCTION(sybase_fetch_row)
        
        array_init(return_value);
        for (i=0; i<result->num_fields; i++) {
-               field_content = (pval *) emalloc(sizeof(pval));
+               field_content = ALLOC_ZVAL();
                *field_content = result->data[result->cur_row][i];
                INIT_PZVAL(field_content);
                pval_copy_constructor(field_content);
@@ -1257,7 +1257,7 @@ static void php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS)
        }
        
        for (i=0; i<result->num_fields; i++) {
-               tmp = (pval *) emalloc(sizeof(pval));
+               tmp = ALLOC_ZVAL();
                *tmp = result->data[result->cur_row][i];
                INIT_PZVAL(tmp);
                if (PG(magic_quotes_runtime) && tmp->type == IS_STRING) {
index 62cd683dc03679c289b257d6d50be6a6ad6d0798..a5ec189660aa365c758018e1d181778de9921930 100644 (file)
@@ -446,7 +446,7 @@ PHPAPI void php_error(int type, const char *format,...)
                va_end(args);
                buffer[sizeof(buffer) - 1] = 0;
 
-               tmp = (pval *)emalloc(sizeof(pval));
+               tmp = ALLOC_ZVAL();
                INIT_PZVAL(tmp);
                tmp->value.str.val = (char *) estrndup(buffer, size);
                tmp->value.str.len = size;
@@ -1079,7 +1079,7 @@ static int zend_hash_environment(PLS_D ELS_DC SLS_DC)
                        continue;
                }
                t = estrndup(*env, p - *env);
-               tmp = (pval *) emalloc(sizeof(pval));
+               tmp = ALLOC_ZVAL();
                tmp->value.str.len = strlen(p + 1);
                tmp->value.str.val = estrndup(p + 1, tmp->value.str.len);
                tmp->type = IS_STRING;
@@ -1100,7 +1100,7 @@ static int zend_hash_environment(PLS_D ELS_DC SLS_DC)
                for (i = 0; i < arr->nelts; i++) {
                        len = strlen(elts[i].key);
                        t = elts[i].key;
-                       tmp = (pval *) emalloc(sizeof(pval));
+                       tmp = ALLOC_ZVAL();
                        if (elts[i].val) {
                                tmp->value.str.len = strlen(elts[i].val);
                                tmp->value.str.val = estrndup(elts[i].val, tmp->value.str.len);
@@ -1117,7 +1117,7 @@ static int zend_hash_environment(PLS_D ELS_DC SLS_DC)
                        (*tmp_ptr)->refcount++;
                        zend_hash_update(&EG(symbol_table), "PATH_TRANSLATED", sizeof("PATH_TRANSLATED"), tmp_ptr, sizeof(pval *), NULL);
                }
-               tmp = (pval *) emalloc(sizeof(pval));
+               tmp = ALLOC_ZVAL();
                tmp->value.str.len = strlen(((request_rec *) SG(server_context))->uri);
                tmp->value.str.val = estrndup(((request_rec *) SG(server_context))->uri, tmp->value.str.len);
                INIT_PZVAL(tmp);
@@ -1130,7 +1130,7 @@ static int zend_hash_environment(PLS_D ELS_DC SLS_DC)
                char *pi;
 #if FORCE_CGI_REDIRECT
                pi = SG(request_info).request_uri;
-               tmp = (pval *) emalloc(sizeof(pval));
+               tmp = ALLOC_ZVAL();
                tmp->value.str.val = emalloc(((pi)?strlen(pi):0) + 1);
                tmp->value.str.len = php_sprintf(tmp->value.str.val, "%s", (pi ? pi : ""));     /* SAFE */
                tmp->type = IS_STRING;
@@ -1148,7 +1148,7 @@ static int zend_hash_environment(PLS_D ELS_DC SLS_DC)
                        l -= strlen(pi);
                        pi = NULL;
                }
-               tmp = (pval *) emalloc(sizeof(pval));
+               tmp = ALLOC_ZVAL();
                tmp->value.str.val = emalloc(l + 1);
                tmp->value.str.len = php_sprintf(tmp->value.str.val, "%s%s", (sn ? sn : ""), (pi ? pi : ""));   /* SAFE */
                tmp->type = IS_STRING;
@@ -1171,7 +1171,7 @@ void _php_build_argv(char *s ELS_DC)
        int count = 0;
        char *ss, *space;
 
-       arr = (pval *) emalloc(sizeof(pval));
+       arr = ALLOC_ZVAL();
        arr->value.ht = (HashTable *) emalloc(sizeof(HashTable));
        if (zend_hash_init(arr->value.ht, 0, NULL, ZVAL_PTR_DTOR, 0) == FAILURE) {
                php_error(E_WARNING, "Unable to create argv array");
@@ -1188,7 +1188,7 @@ void _php_build_argv(char *s ELS_DC)
                        *space = '\0';
                }
                /* auto-type */
-               tmp = (pval *) emalloc(sizeof(pval));
+               tmp = ALLOC_ZVAL();
                tmp->type = IS_STRING;
                tmp->value.str.len = strlen(ss);
                tmp->value.str.val = estrndup(ss, tmp->value.str.len);
@@ -1206,7 +1206,7 @@ void _php_build_argv(char *s ELS_DC)
                        ss = space;
                }
        }
-       tmp = (pval *) emalloc(sizeof(pval));
+       tmp = ALLOC_ZVAL();
        tmp->value.lval = count;
        tmp->type = IS_LONG;
        INIT_PZVAL(tmp);
index a32fd3f057938a1ca72c3791d73fab2c6c145894..cb39d54db32f0633e03a3906f8ed62ebe0926097 100644 (file)
@@ -45,7 +45,7 @@ static void php_mime_split(char *buf, int cnt, char *boundary)
        PLS_FETCH();
 
        if (PG(track_vars)) {
-               http_post_vars = (pval *) emalloc(sizeof(pval));
+               http_post_vars = ALLOC_ZVAL();
                array_init(http_post_vars);
                INIT_PZVAL(http_post_vars);