]> granicus.if.org Git - php/commitdiff
Don't touch refcount and EA directly
authorZeev Suraski <zeev@php.net>
Fri, 9 Jul 1999 20:45:55 +0000 (20:45 +0000)
committerZeev Suraski <zeev@php.net>
Fri, 9 Jul 1999 20:45:55 +0000 (20:45 +0000)
ext/oci8/oci8.c
ext/oracle/oracle.c
ext/pcre/php_pcre.c
ext/rpc/com/COM.c
ext/standard/basic_functions.c
ext/standard/iptc.c
ext/standard/post.c
ext/standard/var.c
ext/xml/xml.c
main/main.c
main/rfc1867.c

index d2549ffaade9b8cdbbda879965f2e0926a882f2e..e8685e908fb6e4173e219e49f7e5cefb977e2e62 100644 (file)
@@ -3166,15 +3166,13 @@ PHP_FUNCTION(oci8_fetchinto)
 
 #if PHP_API_VERSION >= 19990421
                element = emalloc(sizeof(pval));
-               element->EA=0;
-               element->refcount=1;
+               INIT_PZVAL(element);
 #endif
 
                if ((mode & OCI_NUM) || (! (mode & OCI_ASSOC))) { /* OCI_NUM is default */
                        oci8_make_pval(element,statement,column, "OCIFetchInto",mode);
 #if PHP_API_VERSION >= 19990421
-                       element->EA = 0;
-                       element->refcount = 1;
+                       INIT_PZVAL(element);
                        _php3_hash_index_update(array->value.ht, i, (void *)&element, sizeof(pval*), NULL);
 #else
                        _php3_hash_index_update(array->value.ht, i, (void *)element, sizeof(pval), NULL);
@@ -3257,15 +3255,13 @@ PHP_FUNCTION(oci8_fetchstatement)
 
 #if PHP_API_VERSION >= 19990421
                tmp = emalloc(sizeof(pval));
-               tmp->EA = 0;
-               tmp->refcount = 1;
+               INIT_PZVAL(tmp);
 #endif
 
                array_init(tmp);
 
 #if PHP_API_VERSION >= 19990421
-               tmp->EA = 0;
-               tmp->refcount = 1;
+               INIT_PZVAL(tmp);
 #endif
 
                memcpy(namebuf,columns[ i ]->name, columns[ i ]->name_len);
@@ -3297,8 +3293,7 @@ PHP_FUNCTION(oci8_fetchstatement)
 #if PHP_API_VERSION < 19990421
                        _php3_hash_index_update(outarrs[ i ]->value.ht, rows, (void *)element, sizeof(pval), NULL);
 #else
-                       element->refcount = 1;
-                       element->EA = 0;
+                       INIT_PZVAL(element);
                        _php3_hash_index_update((*(outarrs[ i ]))->value.ht, rows, (void *)&element, sizeof(pval*), NULL);
 #endif
                }
index 2b0a22ae7f1f8206bcee803e6c45794e5a6f2269..ace254cb577af77173a42c9ab3138bba6488d08a 100644 (file)
@@ -1225,8 +1225,7 @@ void php3_Ora_FetchInto(INTERNAL_FUNCTION_PARAMETERS)
                } else {
 #if PHP_API_VERSION >= 19990421
                        tmp = emalloc(sizeof(pval));
-                       tmp->EA = 0;
-                       tmp->refcount = 1;
+                       INIT_PZVAL(tmp);
 #endif
 
                        tmp->type = IS_STRING;
index 2e80d02f65dd5679917e76d34a5ba0d900d74777..c11739525da94a6865bbbfee013bd47a68a37b35 100644 (file)
@@ -394,8 +394,7 @@ static void _pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global)
                for (i=0; i<num_subpats; i++) {
                        match_sets[i] = (zval *)emalloc(sizeof(zval));
                        array_init(match_sets[i]);
-                       match_sets[i]->EA = 0;
-                       match_sets[i]->refcount = 1;
+                       INIT_PZVAL(match_sets[i]);
                }
        }
 
@@ -444,8 +443,7 @@ static void _pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global)
                                                /* Allocate the result set array */
                                                result_set = emalloc(sizeof(zval));
                                                array_init(result_set);
-                                               result_set->EA = 0;
-                                               result_set->refcount = 1;
+                                               INIT_PZVAL(result_set);
                                                
                                                /* Add all the subpatterns to it */
                                                for (i=0; i<count; i++) {
index 4bf5d4057266d05e16d9a7a5f27b07ed469d1fc5..f362b39676a250b56a0d21623aecf8de5ecc8641 100644 (file)
@@ -836,8 +836,7 @@ void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_r
                object_handle  = (pval *) emalloc(sizeof(pval));
                *object_handle = *return_value;
                pval_copy_constructor(object_handle);
-               object_handle->refcount = 1;
-               object_handle->EA=0;
+               INIT_PZVAL(object_handle);
                zend_hash_index_update(object->value.obj.properties, 0, &object_handle, sizeof(pval *), NULL);
                pval_destructor(&function_name->element);
        } else {
index ac1e7169706d5d5ad6b8303a3c1351da5f919f4c..fd210e8568aa8be29bb949b264d90aa46e08e85d 100644 (file)
@@ -1082,11 +1082,12 @@ void array_each(INTERNAL_FUNCTION_PARAMETERS)
        entry = *entry_ptr;
 
        /* add value elements */
-       if (entry->EA) {
+       if (entry->EA.is_ref) {
                tmp = (pval *)emalloc(sizeof(pval));
                *tmp = *entry;
                pval_copy_constructor(tmp);
-               tmp->EA=0;
+               tmp->EA.is_ref=0;
+               tmp->EA.locks = 0;
                tmp->refcount=0;
                entry=tmp;
        }
@@ -1130,8 +1131,7 @@ void array_reset(INTERNAL_FUNCTION_PARAMETERS)
                
        *return_value = **entry;
        pval_copy_constructor(return_value);
-       return_value->refcount=1;
-       return_value->EA=0;
+       INIT_PZVAL(return_value);
 }
 
 void array_current(INTERNAL_FUNCTION_PARAMETERS)
@@ -2362,8 +2362,7 @@ PHP_FUNCTION(extract)
                                        data = (zval *)emalloc(sizeof(zval));
                                        *data = *entry;
                                        zval_copy_ctor(data);
-                                       data->EA = 0;
-                                       data->refcount = 1;
+                                       INIT_PZVAL(data);
 
                                        zend_hash_update(EG(active_symbol_table), finalname,
                                                                          strlen(finalname)+1, &data, sizeof(zval *), NULL);
@@ -2392,8 +2391,7 @@ static void _compact_var(HashTable *eg_active_symbol_table, zval *return_value,
                        data = (zval *)emalloc(sizeof(zval));
                        *data = *value;
                        zval_copy_ctor(data);
-                       data->EA = 0;
-                       data->refcount = 1;
+                       INIT_PZVAL(data);
                        
                        zend_hash_update(return_value->value.ht, entry->value.str.val,
                                                         entry->value.str.len+1, &data, sizeof(zval *), NULL);
@@ -2603,8 +2601,7 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end)
        zend_hash_get_current_data(stack->value.ht, (void **)&val);
        *return_value = **val;
        zval_copy_ctor(return_value);
-       return_value->refcount=1;
-       return_value->EA=0;
+       INIT_PZVAL(return_value);
        
        /* Delete the first or last value */
        new_hash = _phpi_splice(stack->value.ht, (off_the_end) ? -1 : 0, 1, NULL, 0, NULL);
@@ -2919,8 +2916,7 @@ PHP_FUNCTION(array_keys)
        zend_hash_internal_pointer_reset(input->value.ht);
        while(zend_hash_get_current_data(input->value.ht, (void **)&entry) == SUCCESS) {
                new_val = (zval *)emalloc(sizeof(zval));
-               new_val->EA = 0;
-               new_val->refcount = 1;
+               INIT_PZVAL(new_val);
                
                switch (zend_hash_get_current_key(input->value.ht, &string_key, &num_key)) {
                        case HASH_KEY_IS_STRING:
index 78843059f45f4b08d689e7d90e8fb76c8faeecaa..6c8224d1edfc05ba67b622b4136565d4c56a8748 100644 (file)
@@ -368,8 +368,7 @@ PHP_FUNCTION(iptcparse)
 
                if (_php3_hash_find(return_value->value.ht,key,strlen(key) + 1,(void **) &element) == FAILURE) {
                        values = emalloc(sizeof(pval));
-                       values->EA = 0;
-                       values->refcount = 1;
+                       INIT_PZVAL(values);
                        if (array_init(values) == FAILURE) {
                                php3_error(E_ERROR, "Unable to initialize array");
                                RETURN_FALSE;
index 8d23632a736e22d98ae48190ae6ffcd47f56e8f4..45049662f58521e1b93005469a7ff1e124f95d03 100644 (file)
@@ -143,8 +143,7 @@ static char *php3_getpost(pval *http_post_vars PLS_DC)
                postdata_ptr->type = IS_STRING;
                postdata_ptr->value.str.val = (char *) estrdup(buf);
                postdata_ptr->value.str.len = cnt;
-               postdata_ptr->refcount=1;
-               postdata_ptr->EA=0;
+               INIT_PZVAL(postdata_ptr);
                _php3_hash_add(&symbol_table, "HTTP_FDF_DATA", sizeof("HTTP_FDF_DATA"), postdata_ptr, sizeof(pval *),NULL);
        }
 #endif
@@ -224,16 +223,14 @@ void _php3_parse_gpc_data(char *val, char *var, pval *track_vars_array)
                /* If the array doesn't exist, create it */
                if (_php3_hash_find(EG(active_symbol_table), var, var_len+1, (void **) &arr_ptr) == FAILURE) {
                        arr1 = (pval *) emalloc(sizeof(pval));
-                       arr1->refcount=1;
-                       arr1->EA=0;
+                       INIT_PZVAL(arr1);
                        if (array_init(arr1)==FAILURE) {
                                return;
                        }
                        _php3_hash_update(EG(active_symbol_table), var, var_len+1, &arr1, sizeof(pval *), NULL);
                        if (track_vars_array) {
                                arr2 = (pval *) emalloc(sizeof(pval));
-                               arr2->refcount=1;
-                               arr2->EA=0;
+                               INIT_PZVAL(arr2);
                                if (array_init(arr2)==FAILURE) {
                                        return;
                                }
@@ -243,8 +240,7 @@ void _php3_parse_gpc_data(char *val, char *var, pval *track_vars_array)
                        if ((*arr_ptr)->type!=IS_ARRAY) {
                                if (--(*arr_ptr) > 0) {
                                        *arr_ptr = (pval *) emalloc(sizeof(pval));
-                                       (*arr_ptr)->refcount=1;
-                                       (*arr_ptr)->EA=0;
+                                       INIT_PZVAL(*arr_ptr);
                                } else {
                                        pval_destructor(*arr_ptr);
                                }
@@ -253,8 +249,7 @@ void _php3_parse_gpc_data(char *val, char *var, pval *track_vars_array)
                                }
                                if (track_vars_array) {
                                        arr2 = (pval *) emalloc(sizeof(pval));
-                                       arr2->refcount=1;
-                                       arr2->EA=0;
+                                       INIT_PZVAL(arr2);
                                        if (array_init(arr2)==FAILURE) {
                                                return;
                                        }
@@ -269,8 +264,7 @@ void _php3_parse_gpc_data(char *val, char *var, pval *track_vars_array)
                }
                /* Now create the element */
                entry = (pval *) emalloc(sizeof(pval));
-               entry->refcount=1;
-               entry->EA=0;
+               INIT_PZVAL(entry);
                entry->value.str.val = val;
                entry->value.str.len = val_len;
                entry->type = IS_STRING;
@@ -303,8 +297,7 @@ void _php3_parse_gpc_data(char *val, char *var, pval *track_vars_array)
                pval *entry = (pval *) emalloc(sizeof(pval));
                
                entry->type = IS_STRING;
-               entry->refcount=1;
-               entry->EA=0;
+               INIT_PZVAL(entry);
                entry->value.str.val = val;
                entry->value.str.len = val_len;
                _php3_hash_update(EG(active_symbol_table), var, var_len+1, (void *) &entry, sizeof(pval *),NULL);
@@ -332,8 +325,7 @@ void php3_treat_data(int arg, char *str)
                        if (PG(track_vars)) {
                                array_ptr = (pval *) emalloc(sizeof(pval));
                                array_init(array_ptr);
-                               array_ptr->refcount=1;
-                               array_ptr->EA=0;
+                               INIT_PZVAL(array_ptr);
                                switch (arg) {
                                        case PARSE_POST:
                                                _php3_hash_add(&EG(symbol_table), "HTTP_POST_VARS", sizeof("HTTP_POST_VARS"), &array_ptr, sizeof(pval *),NULL);
index c05b7a6dec3cd68320b34620997393b1eb3c54e1..57b5e4e0980b1a748e37098ec487fb2616ec7be5 100644 (file)
@@ -324,8 +324,7 @@ int php3api_var_unserialize(pval **rval, const char **p, const char *max)
                        } else {
                                (*rval)->type = IS_LONG;
                        }
-                       (*rval)->refcount = 1;
-                       (*rval)->EA = 0;
+                       INIT_PZVAL(*rval);
                        (*rval)->value.lval = atol(q + 2);
                        return 1;
 
@@ -342,8 +341,7 @@ int php3api_var_unserialize(pval **rval, const char **p, const char *max)
                        }
                        (*p)++;
                        (*rval)->type = IS_DOUBLE;
-                       (*rval)->refcount = 1;
-                       (*rval)->EA = 0;
+                       INIT_PZVAL(*rval);
                        (*rval)->value.dval = atof(q + 2);
                        return 1;
 
@@ -374,15 +372,13 @@ int php3api_var_unserialize(pval **rval, const char **p, const char *max)
                        (*rval)->type = IS_STRING;
                        (*rval)->value.str.val = str;
                        (*rval)->value.str.len = i;
-                       (*rval)->refcount = 1;
-                       (*rval)->EA = 0;
+                       INIT_PZVAL(*rval);
                        return 1;
 
                case 'a':
                        (*rval)->type = IS_ARRAY;
 
-                       (*rval)->refcount = 1;
-                       (*rval)->EA = 0;
+                       INIT_PZVAL(*rval);
                        (*p) += 2;
                        i = atoi(*p);
                        (*rval)->value.ht = (HashTable *) emalloc(sizeof(HashTable));
@@ -423,8 +419,7 @@ int php3api_var_unserialize(pval **rval, const char **p, const char *max)
                case 'o':
                        (*rval)->type = IS_OBJECT;
 
-                       (*rval)->refcount = 1;
-                       (*rval)->EA = 0;
+                       INIT_PZVAL(*rval);
                        (*p) += 2;
                        i = atoi(*p);
                        (*rval)->value.obj.properties = (HashTable *) emalloc(sizeof(HashTable));
index 4734fc46d74fc43d050d0f5b276f5b1fb852d1ef..464bd57f1482da43c923375c180ff2fd11fe1689 100644 (file)
@@ -109,8 +109,7 @@ static pval *php3i_long_pval(long value)
  
     ret->type = IS_LONG;
     ret->value.lval = value;
-       ret->EA = 0;
-       ret->refcount = 1;
+       INIT_PZVAL(ret);
     return ret;
 }
 
@@ -121,8 +120,7 @@ static pval *php3i_string_pval(const char *str)
  
     ret->type = IS_STRING;
     ret->value.str.len = len;
-       ret->EA = 0;
-       ret->refcount = 1;
+       INIT_PZVAL(ret);
     ret->value.str.val = estrndup(str, len);
     return ret;
 } 
@@ -647,8 +645,7 @@ static void php3i_add_to_info(xml_parser *parser,char *name)
                        return;
                }
 
-               values->EA = 0;
-               values->refcount = 1;
+               INIT_PZVAL(values);
                
                _php3_hash_update(parser->info->value.ht, name, strlen(name)+1, (void *) &values, sizeof(pval*), (void **) &element);
        } 
@@ -712,12 +709,10 @@ void php3i_xml_startElementHandler(void *userData, const char *name,
                        int atcnt = 0;
 
                        tag = emalloc(sizeof(pval));
-                       tag->EA = 0;
-                       tag->refcount = 1;
+                       INIT_PZVAL(tag);
 
                        atr = emalloc(sizeof(pval));
-                       atr->EA = 0;
-                       atr->refcount = 1;
+                       INIT_PZVAL(atr);
 
                        array_init(tag);
                        array_init(atr);
@@ -802,8 +797,7 @@ void php3i_xml_endElementHandler(void *userData, const char *name)
                                tag = emalloc(sizeof(pval));
 
                                array_init(tag);
-                               tag->EA = 0;
-                               tag->refcount = 1;
+                               INIT_PZVAL(tag);
                                  
                                php3i_add_to_info(parser,((char *) name) + parser->toffset);
 
index 1373a3c0f5c97dc4b67f3cf7fc535e0bc350a03e..393a4636b5771615d21b6e0199a94efe2db96669 100644 (file)
@@ -944,8 +944,7 @@ int _php3_hash_environment(PLS_D ELS_DC)
                tmp->value.str.len = strlen(p + 1);
                tmp->value.str.val = estrndup(p + 1, tmp->value.str.len);
                tmp->type = IS_STRING;
-               tmp->refcount=1;
-               tmp->EA=0;
+               INIT_PZVAL(tmp);
                /* environmental variables never take precedence over get/post/cookie variables */
                _php3_hash_add(&EG(symbol_table), t, p - *env + 1, &tmp, sizeof(pval *), NULL);
                efree(t);
@@ -970,8 +969,7 @@ int _php3_hash_environment(PLS_D ELS_DC)
                                tmp->value.str.len = 0;
                                tmp->value.str.val = empty_string;
                        }
-                       tmp->refcount=1;
-                       tmp->EA=0;
+                       INIT_PZVAL(tmp);
                        tmp->type = IS_STRING;
                        _php3_hash_update(&EG(symbol_table), t, strlen(t)+1, &tmp, sizeof(pval *), NULL);
                }
@@ -983,8 +981,7 @@ int _php3_hash_environment(PLS_D ELS_DC)
                tmp = (pval *) emalloc(sizeof(pval));
                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);
-               tmp->refcount=1;
-               tmp->EA=0;
+               INIT_PZVAL(tmp);
                tmp->type = IS_STRING;
                _php3_hash_update(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF"), (void *) &tmp, sizeof(pval *), NULL);
        }
@@ -998,8 +995,7 @@ int _php3_hash_environment(PLS_D ELS_DC)
                tmp->value.str.val = emalloc(((pi)?strlen(pi):0) + 1);
                tmp->value.str.len = _php3_sprintf(tmp->value.str.val, "%s", (pi ? pi : ""));   /* SAFE */
                tmp->type = IS_STRING;
-               tmp->refcount=1;
-               tmp->EA=0;
+               INIT_PZVAL(tmp);
 #else
                int l = 0;
                char *sn;
@@ -1017,8 +1013,7 @@ int _php3_hash_environment(PLS_D ELS_DC)
                tmp->value.str.val = emalloc(l + 1);
                tmp->value.str.len = _php3_sprintf(tmp->value.str.val, "%s%s", (sn ? sn : ""), (pi ? pi : "")); /* SAFE */
                tmp->type = IS_STRING;
-               tmp->refcount=1;
-               tmp->EA=0;
+               INIT_PZVAL(tmp);
 #endif
                _php3_hash_update(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF"), (void *) & tmp, sizeof(pval *), NULL);
        }
@@ -1043,8 +1038,7 @@ void _php3_build_argv(char *s ELS_DC)
                php3_error(E_WARNING, "Unable to create argv array");
        } else {
                arr->type = IS_ARRAY;
-               arr->refcount=1;
-               arr->EA=0;
+               INIT_PZVAL(arr);
                _php3_hash_update(&EG(symbol_table), "argv", sizeof("argv"), &arr, sizeof(pval *), NULL);
        }
        /* now pick out individual entries */
@@ -1059,8 +1053,7 @@ void _php3_build_argv(char *s ELS_DC)
                tmp->type = IS_STRING;
                tmp->value.str.len = strlen(ss);
                tmp->value.str.val = estrndup(ss, tmp->value.str.len);
-               tmp->refcount=1;
-               tmp->EA=0;
+               INIT_PZVAL(tmp);
                count++;
                if (_php3_hash_next_index_insert(arr->value.ht, &tmp, sizeof(pval *), NULL)==FAILURE) {
                        if (tmp->type == IS_STRING) {
@@ -1077,8 +1070,7 @@ void _php3_build_argv(char *s ELS_DC)
        tmp = (pval *) emalloc(sizeof(pval));
        tmp->value.lval = count;
        tmp->type = IS_LONG;
-       tmp->refcount=1;
-       tmp->EA=0;
+       INIT_PZVAL(tmp);
        _php3_hash_add(&EG(symbol_table), "argc", sizeof("argc"), &tmp, sizeof(pval *), NULL);
 }
 
index 86f07fbbf7b264e7ea8995adaa855e7ab1f4700f..018b174c90e31296358c53241ca8641753fa12d2 100644 (file)
@@ -61,8 +61,7 @@ void php_mime_split(char *buf, int cnt, char *boundary)
        if (PG(track_vars)) {
                http_post_vars = (pval *) emalloc(sizeof(pval));
                array_init(http_post_vars);
-               http_post_vars->refcount=1;
-               http_post_vars->EA=0;
+               INIT_PZVAL(http_post_vars);
                
                zend_hash_add(&EG(symbol_table), "HTTP_POST_VARS", sizeof("HTTP_POST_VARS"), &http_post_vars, sizeof(pval *), NULL);
        }