Browse Source

Change ALLOC_ZVAL() semantics

PHP-4.0.5
Zeev Suraski 27 years ago
parent
commit
235386b245
  1. 8
      Zend/zend.h
  2. 91
      Zend/zend_API.c
  3. 12
      Zend/zend_API.h
  4. 4
      Zend/zend_builtin_functions.c
  5. 10
      Zend/zend_compile.c
  6. 60
      Zend/zend_execute.c
  7. 9
      Zend/zend_execute_API.c
  8. 3
      Zend/zend_operators.c
  9. 2
      ext/dav/dav.c
  10. 2
      ext/hyperwave/hw.c
  11. 2
      ext/java/java.c
  12. 2
      ext/odbc/php_odbc.c
  13. 4
      ext/pcre/php_pcre.c
  14. 4
      ext/rpc/com/COM.c
  15. 2
      ext/rpc/java/java.c
  16. 2
      ext/session/session.c
  17. 2
      ext/standard/array.c
  18. 2
      ext/standard/iptc.c
  19. 6
      ext/standard/post.c
  20. 16
      ext/standard/var.c
  21. 4
      ext/sybase_ct/php_sybase_ct.c
  22. 8
      ext/wddx/wddx.c
  23. 18
      main/main.c
  24. 2
      main/rfc1867.c
  25. 3
      sapi/isapi/php4isapi.c

8
Zend/zend.h

@ -284,16 +284,16 @@ END_EXTERN_C()
#define INIT_ZVAL(z) z = zval_used_for_init; #define INIT_ZVAL(z) z = zval_used_for_init;
#define ALLOC_ZVAL() (zval *) emalloc(sizeof(zval))
#define ALLOC_ZVAL(z) (z) = (zval *) emalloc(sizeof(zval))
#define FREE_ZVAL(z) efree(z) #define FREE_ZVAL(z) efree(z)
#define ALLOC_INIT_ZVAL(zp) \ #define ALLOC_INIT_ZVAL(zp) \
(zp) = ALLOC_ZVAL(); \
ALLOC_ZVAL(zp); \
INIT_ZVAL(*zp); INIT_ZVAL(*zp);
#define MAKE_STD_ZVAL(zv) \ #define MAKE_STD_ZVAL(zv) \
zv = ALLOC_ZVAL(); \
ALLOC_ZVAL(zv); \
INIT_PZVAL(zv); INIT_PZVAL(zv);
#define SEPARATE_ZVAL(ppzv) \ #define SEPARATE_ZVAL(ppzv) \
@ -302,7 +302,7 @@ END_EXTERN_C()
\ \
if (orig_ptr->refcount>1) { \ if (orig_ptr->refcount>1) { \
orig_ptr->refcount--; \ orig_ptr->refcount--; \
*(ppzv) = ALLOC_ZVAL(); \
ALLOC_ZVAL(*(ppzv)); \
**(ppzv) = *orig_ptr; \ **(ppzv) = *orig_ptr; \
zval_copy_ctor(*(ppzv)); \ zval_copy_ctor(*(ppzv)); \
(*(ppzv))->refcount=1; \ (*(ppzv))->refcount=1; \

91
Zend/zend_API.c

@ -58,7 +58,7 @@ ZEND_API int zend_get_parameters(int ht, int param_count,...)
if (!PZVAL_IS_REF(param_ptr) && param_ptr->refcount>1) { if (!PZVAL_IS_REF(param_ptr) && param_ptr->refcount>1) {
zval *new_tmp; zval *new_tmp;
new_tmp = ALLOC_ZVAL();
ALLOC_ZVAL(new_tmp);
*new_tmp = *param_ptr; *new_tmp = *param_ptr;
zval_copy_ctor(new_tmp); zval_copy_ctor(new_tmp);
INIT_PZVAL(new_tmp); INIT_PZVAL(new_tmp);
@ -95,7 +95,7 @@ ZEND_API int zend_get_parameters_array(int ht, int param_count, zval **argument_
if (!PZVAL_IS_REF(param_ptr) && param_ptr->refcount>1) { if (!PZVAL_IS_REF(param_ptr) && param_ptr->refcount>1) {
zval *new_tmp; zval *new_tmp;
new_tmp = ALLOC_ZVAL();
ALLOC_ZVAL(new_tmp);
*new_tmp = *param_ptr; *new_tmp = *param_ptr;
zval_copy_ctor(new_tmp); zval_copy_ctor(new_tmp);
INIT_PZVAL(new_tmp); INIT_PZVAL(new_tmp);
@ -230,8 +230,9 @@ ZEND_API inline int add_assoc_function(zval *arg, char *key,void (*function_ptr)
ZEND_API inline int add_assoc_long(zval *arg, char *key, long n) ZEND_API inline int add_assoc_long(zval *arg, char *key, long n)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_LONG; tmp->type = IS_LONG;
tmp->value.lval = n; tmp->value.lval = n;
INIT_PZVAL(tmp); INIT_PZVAL(tmp);
@ -241,8 +242,9 @@ ZEND_API inline int add_assoc_long(zval *arg, char *key, long n)
ZEND_API inline int add_assoc_bool(zval *arg, char *key, int b) ZEND_API inline int add_assoc_bool(zval *arg, char *key, int b)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_BOOL; tmp->type = IS_BOOL;
tmp->value.lval = b; tmp->value.lval = b;
INIT_PZVAL(tmp); INIT_PZVAL(tmp);
@ -252,8 +254,9 @@ ZEND_API inline int add_assoc_bool(zval *arg, char *key, int b)
ZEND_API inline int add_assoc_resource(zval *arg, char *key, int r) ZEND_API inline int add_assoc_resource(zval *arg, char *key, int r)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_RESOURCE; tmp->type = IS_RESOURCE;
tmp->value.lval = r; tmp->value.lval = r;
INIT_PZVAL(tmp); INIT_PZVAL(tmp);
@ -263,8 +266,9 @@ ZEND_API inline int add_assoc_resource(zval *arg, char *key, int r)
ZEND_API inline int add_assoc_double(zval *arg, char *key, double d) ZEND_API inline int add_assoc_double(zval *arg, char *key, double d)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_DOUBLE; tmp->type = IS_DOUBLE;
tmp->value.dval = d; tmp->value.dval = d;
INIT_PZVAL(tmp); INIT_PZVAL(tmp);
@ -274,8 +278,9 @@ ZEND_API inline int add_assoc_double(zval *arg, char *key, double d)
ZEND_API inline int add_assoc_string(zval *arg, char *key, char *str, int duplicate) ZEND_API inline int add_assoc_string(zval *arg, char *key, char *str, int duplicate)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_STRING; tmp->type = IS_STRING;
tmp->value.str.len = strlen(str); tmp->value.str.len = strlen(str);
if (duplicate) { if (duplicate) {
@ -290,8 +295,9 @@ ZEND_API inline int add_assoc_string(zval *arg, char *key, char *str, int duplic
ZEND_API inline int add_assoc_stringl(zval *arg, char *key, char *str, uint length, int duplicate) ZEND_API inline int add_assoc_stringl(zval *arg, char *key, char *str, uint length, int duplicate)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_STRING; tmp->type = IS_STRING;
tmp->value.str.len = length; tmp->value.str.len = length;
if (duplicate) { if (duplicate) {
@ -306,8 +312,9 @@ ZEND_API inline int add_assoc_stringl(zval *arg, char *key, char *str, uint leng
ZEND_API inline int add_index_long(zval *arg, uint index, long n) ZEND_API inline int add_index_long(zval *arg, uint index, long n)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_LONG; tmp->type = IS_LONG;
tmp->value.lval = n; tmp->value.lval = n;
INIT_PZVAL(tmp); INIT_PZVAL(tmp);
@ -317,8 +324,9 @@ ZEND_API inline int add_index_long(zval *arg, uint index, long n)
ZEND_API inline int add_index_bool(zval *arg, uint index, int b) ZEND_API inline int add_index_bool(zval *arg, uint index, int b)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_BOOL; tmp->type = IS_BOOL;
tmp->value.lval = b; tmp->value.lval = b;
INIT_PZVAL(tmp); INIT_PZVAL(tmp);
@ -328,8 +336,9 @@ ZEND_API inline int add_index_bool(zval *arg, uint index, int b)
ZEND_API inline int add_index_resource(zval *arg, uint index, int r) ZEND_API inline int add_index_resource(zval *arg, uint index, int r)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_RESOURCE; tmp->type = IS_RESOURCE;
tmp->value.lval = r; tmp->value.lval = r;
INIT_PZVAL(tmp); INIT_PZVAL(tmp);
@ -339,8 +348,9 @@ ZEND_API inline int add_index_resource(zval *arg, uint index, int r)
ZEND_API inline int add_index_double(zval *arg, uint index, double d) ZEND_API inline int add_index_double(zval *arg, uint index, double d)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_DOUBLE; tmp->type = IS_DOUBLE;
tmp->value.dval = d; tmp->value.dval = d;
INIT_PZVAL(tmp); INIT_PZVAL(tmp);
@ -350,8 +360,9 @@ ZEND_API inline int add_index_double(zval *arg, uint index, double d)
ZEND_API inline int add_index_string(zval *arg, uint index, char *str, int duplicate) ZEND_API inline int add_index_string(zval *arg, uint index, char *str, int duplicate)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_STRING; tmp->type = IS_STRING;
tmp->value.str.len = strlen(str); tmp->value.str.len = strlen(str);
if (duplicate) { if (duplicate) {
@ -366,8 +377,9 @@ ZEND_API inline int add_index_string(zval *arg, uint index, char *str, int dupli
ZEND_API inline int add_index_stringl(zval *arg, uint index, char *str, uint length, int duplicate) ZEND_API inline int add_index_stringl(zval *arg, uint index, char *str, uint length, int duplicate)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_STRING; tmp->type = IS_STRING;
tmp->value.str.len = length; tmp->value.str.len = length;
if (duplicate) { if (duplicate) {
@ -382,8 +394,9 @@ ZEND_API inline int add_index_stringl(zval *arg, uint index, char *str, uint len
ZEND_API inline int add_next_index_long(zval *arg, long n) ZEND_API inline int add_next_index_long(zval *arg, long n)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_LONG; tmp->type = IS_LONG;
tmp->value.lval = n; tmp->value.lval = n;
INIT_PZVAL(tmp); INIT_PZVAL(tmp);
@ -393,8 +406,9 @@ ZEND_API inline int add_next_index_long(zval *arg, long n)
ZEND_API inline int add_next_index_bool(zval *arg, int b) ZEND_API inline int add_next_index_bool(zval *arg, int b)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_BOOL; tmp->type = IS_BOOL;
tmp->value.lval = b; tmp->value.lval = b;
INIT_PZVAL(tmp); INIT_PZVAL(tmp);
@ -404,8 +418,9 @@ ZEND_API inline int add_next_index_bool(zval *arg, int b)
ZEND_API inline int add_next_index_resource(zval *arg, int r) ZEND_API inline int add_next_index_resource(zval *arg, int r)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_RESOURCE; tmp->type = IS_RESOURCE;
tmp->value.lval = r; tmp->value.lval = r;
INIT_PZVAL(tmp); INIT_PZVAL(tmp);
@ -415,8 +430,9 @@ ZEND_API inline int add_next_index_resource(zval *arg, int r)
ZEND_API inline int add_next_index_double(zval *arg, double d) ZEND_API inline int add_next_index_double(zval *arg, double d)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_DOUBLE; tmp->type = IS_DOUBLE;
tmp->value.dval = d; tmp->value.dval = d;
INIT_PZVAL(tmp); INIT_PZVAL(tmp);
@ -426,8 +442,9 @@ ZEND_API inline int add_next_index_double(zval *arg, double d)
ZEND_API inline int add_next_index_string(zval *arg, char *str, int duplicate) ZEND_API inline int add_next_index_string(zval *arg, char *str, int duplicate)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_STRING; tmp->type = IS_STRING;
tmp->value.str.len = strlen(str); tmp->value.str.len = strlen(str);
if (duplicate) { if (duplicate) {
@ -442,8 +459,9 @@ ZEND_API inline int add_next_index_string(zval *arg, char *str, int duplicate)
ZEND_API inline int add_next_index_stringl(zval *arg, char *str, uint length, int duplicate) ZEND_API inline int add_next_index_stringl(zval *arg, char *str, uint length, int duplicate)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_STRING; tmp->type = IS_STRING;
tmp->value.str.len = length; tmp->value.str.len = length;
if (duplicate) { if (duplicate) {
@ -458,8 +476,9 @@ ZEND_API inline int add_next_index_stringl(zval *arg, char *str, uint length, in
ZEND_API inline int add_get_assoc_string(zval *arg, char *key, char *str, void **dest, int duplicate) ZEND_API inline int add_get_assoc_string(zval *arg, char *key, char *str, void **dest, int duplicate)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_STRING; tmp->type = IS_STRING;
tmp->value.str.len = strlen(str); tmp->value.str.len = strlen(str);
if (duplicate) { if (duplicate) {
@ -474,8 +493,9 @@ ZEND_API inline int add_get_assoc_string(zval *arg, char *key, char *str, void *
ZEND_API inline int add_get_assoc_stringl(zval *arg, char *key, char *str, uint length, void **dest, int duplicate) ZEND_API inline int add_get_assoc_stringl(zval *arg, char *key, char *str, uint length, void **dest, int duplicate)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_STRING; tmp->type = IS_STRING;
tmp->value.str.len = length; tmp->value.str.len = length;
if (duplicate) { if (duplicate) {
@ -490,8 +510,9 @@ ZEND_API inline int add_get_assoc_stringl(zval *arg, char *key, char *str, uint
ZEND_API inline int add_get_index_long(zval *arg, uint index, long l, void **dest) ZEND_API inline int add_get_index_long(zval *arg, uint index, long l, void **dest)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_LONG; tmp->type = IS_LONG;
tmp->value.lval = l; tmp->value.lval = l;
INIT_PZVAL(tmp); INIT_PZVAL(tmp);
@ -501,8 +522,9 @@ ZEND_API inline int add_get_index_long(zval *arg, uint index, long l, void **des
ZEND_API inline int add_get_index_double(zval *arg, uint index, double d, void **dest) ZEND_API inline int add_get_index_double(zval *arg, uint index, double d, void **dest)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_DOUBLE; tmp->type = IS_DOUBLE;
tmp->value.dval= d; tmp->value.dval= d;
INIT_PZVAL(tmp); INIT_PZVAL(tmp);
@ -512,8 +534,9 @@ ZEND_API inline int add_get_index_double(zval *arg, uint index, double d, void *
ZEND_API inline int add_get_index_string(zval *arg, uint index, char *str, void **dest, int duplicate) ZEND_API inline int add_get_index_string(zval *arg, uint index, char *str, void **dest, int duplicate)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_STRING; tmp->type = IS_STRING;
tmp->value.str.len = strlen(str); tmp->value.str.len = strlen(str);
if (duplicate) { if (duplicate) {
@ -528,8 +551,9 @@ ZEND_API inline int add_get_index_string(zval *arg, uint index, char *str, void
ZEND_API inline int add_get_index_stringl(zval *arg, uint index, char *str, uint length, void **dest, int duplicate) ZEND_API inline int add_get_index_stringl(zval *arg, uint index, char *str, uint length, void **dest, int duplicate)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_STRING; tmp->type = IS_STRING;
tmp->value.str.len = length; tmp->value.str.len = length;
if (duplicate) { if (duplicate) {
@ -544,8 +568,9 @@ ZEND_API inline int add_get_index_stringl(zval *arg, uint index, char *str, uint
ZEND_API inline int add_property_long(zval *arg, char *key, long n) ZEND_API inline int add_property_long(zval *arg, char *key, long n)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_LONG; tmp->type = IS_LONG;
tmp->value.lval = n; tmp->value.lval = n;
INIT_PZVAL(tmp); INIT_PZVAL(tmp);
@ -554,8 +579,9 @@ ZEND_API inline int add_property_long(zval *arg, char *key, long n)
ZEND_API inline int add_property_resource(zval *arg, char *key, long n) ZEND_API inline int add_property_resource(zval *arg, char *key, long n)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_RESOURCE; tmp->type = IS_RESOURCE;
tmp->value.lval = n; tmp->value.lval = n;
INIT_PZVAL(tmp); INIT_PZVAL(tmp);
@ -565,8 +591,9 @@ ZEND_API inline int add_property_resource(zval *arg, char *key, long n)
ZEND_API inline int add_property_double(zval *arg, char *key, double d) ZEND_API inline int add_property_double(zval *arg, char *key, double d)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_DOUBLE; tmp->type = IS_DOUBLE;
tmp->value.dval = d; tmp->value.dval = d;
INIT_PZVAL(tmp); INIT_PZVAL(tmp);
@ -576,8 +603,9 @@ ZEND_API inline int add_property_double(zval *arg, char *key, double d)
ZEND_API inline int add_property_string(zval *arg, char *key, char *str, int duplicate) ZEND_API inline int add_property_string(zval *arg, char *key, char *str, int duplicate)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_STRING; tmp->type = IS_STRING;
tmp->value.str.len = strlen(str); tmp->value.str.len = strlen(str);
if (duplicate) { if (duplicate) {
@ -592,8 +620,9 @@ ZEND_API inline int add_property_string(zval *arg, char *key, char *str, int dup
ZEND_API inline int add_property_stringl(zval *arg, char *key, char *str, uint length, int duplicate) ZEND_API inline int add_property_stringl(zval *arg, char *key, char *str, uint length, int duplicate)
{ {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->type = IS_STRING; tmp->type = IS_STRING;
tmp->value.str.len = length; tmp->value.str.len = length;
if (duplicate) { if (duplicate) {

12
Zend/zend_API.h

@ -212,9 +212,10 @@ ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length,
#define SET_VAR_STRING(n,v) { \ #define SET_VAR_STRING(n,v) { \
{ \ { \
zval *var = ALLOC_ZVAL(); \
zval *var; \
char *str=(v); /* prevent 'v' from being evaluated more than once */ \ char *str=(v); /* prevent 'v' from being evaluated more than once */ \
\ \
ALLOC_ZVAL(var); \
var->value.str.val = (str); \ var->value.str.val = (str); \
var->value.str.len = strlen((str)); \ var->value.str.len = strlen((str)); \
var->type = IS_STRING; \ var->type = IS_STRING; \
@ -224,8 +225,9 @@ ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length,
#define SET_VAR_STRINGL(n,v,l) { \ #define SET_VAR_STRINGL(n,v,l) { \
{ \ { \
zval *var = ALLOC_ZVAL(); \
zval *var; \
\ \
ALLOC_ZVAL(var); \
var->value.str.val = (v); \ var->value.str.val = (v); \
var->value.str.len = (l); \ var->value.str.len = (l); \
var->type = IS_STRING; \ var->type = IS_STRING; \
@ -235,8 +237,9 @@ ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length,
#define SET_VAR_LONG(n,v) { \ #define SET_VAR_LONG(n,v) { \
{ \ { \
zval *var = ALLOC_ZVAL(); \
zval *var; \
\ \
ALLOC_ZVAL(var); \
var->value.lval = (v); \ var->value.lval = (v); \
var->type = IS_LONG; \ var->type = IS_LONG; \
ZEND_SET_GLOBAL_VAR(n, var); \ ZEND_SET_GLOBAL_VAR(n, var); \
@ -245,8 +248,9 @@ ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length,
#define SET_VAR_DOUBLE(n,v) { \ #define SET_VAR_DOUBLE(n,v) { \
{ \ { \
zval *var = ALLOC_ZVAL(); \
zval *var; \
\ \
ALLOC_ZVAL(var); \
var->value.dval = (v); \ var->value.dval = (v); \
var->type = IS_DOUBLE; \ var->type = IS_DOUBLE; \
ZEND_SET_GLOBAL_VAR(n, var); \ ZEND_SET_GLOBAL_VAR(n, var); \

4
Zend/zend_builtin_functions.c

@ -162,7 +162,7 @@ ZEND_FUNCTION(func_get_args)
for (i=0; i<arg_count; i++) { for (i=0; i<arg_count; i++) {
zval *element; zval *element;
element = ALLOC_ZVAL();
ALLOC_ZVAL(element);
*element = **((zval **) (p-(arg_count-i))); *element = **((zval **) (p-(arg_count-i)));
zval_copy_ctor(element); zval_copy_ctor(element);
INIT_PZVAL(element); INIT_PZVAL(element);
@ -239,7 +239,7 @@ ZEND_FUNCTION(each)
/* add value elements */ /* add value elements */
if (entry->is_ref) { if (entry->is_ref) {
tmp = ALLOC_ZVAL();
ALLOC_ZVAL(tmp);
*tmp = *entry; *tmp = *entry;
zval_copy_ctor(tmp); zval_copy_ctor(tmp);
tmp->is_ref=0; tmp->is_ref=0;

10
Zend/zend_compile.c

@ -1498,7 +1498,9 @@ void do_end_class_declaration(CLS_D)
void do_declare_property(znode *var_name, znode *value CLS_DC) void do_declare_property(znode *var_name, znode *value CLS_DC)
{ {
if (value) { if (value) {
zval *property = ALLOC_ZVAL();
zval *property;
ALLOC_ZVAL(property);
*property = value->u.constant; *property = value->u.constant;
zend_hash_update(&CG(active_class_entry)->default_properties, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL); zend_hash_update(&CG(active_class_entry)->default_properties, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL);
@ -1687,8 +1689,9 @@ void do_add_array_element(znode *result, znode *expr, znode *offset, int is_ref
void do_add_static_array_element(znode *result, znode *offset, znode *expr) void do_add_static_array_element(znode *result, znode *offset, znode *expr)
{ {
zval *element = ALLOC_ZVAL();
zval *element;
ALLOC_ZVAL(element);
*element = expr->u.constant; *element = expr->u.constant;
if (offset) { if (offset) {
switch (offset->u.constant.type) { switch (offset->u.constant.type) {
@ -1807,8 +1810,9 @@ void do_fetch_global_or_static_variable(znode *varname, znode *static_assignment
znode lval; znode lval;
if (fetch_type==ZEND_FETCH_STATIC && static_assignment) { if (fetch_type==ZEND_FETCH_STATIC && static_assignment) {
zval *tmp = ALLOC_ZVAL();
zval *tmp;
ALLOC_ZVAL(tmp);
convert_to_string(&varname->u.constant); convert_to_string(&varname->u.constant);
*tmp = static_assignment->u.constant; *tmp = static_assignment->u.constant;
if (!CG(active_op_array)->static_variables) { if (!CG(active_op_array)->static_variables) {

60
Zend/zend_execute.c

@ -354,7 +354,7 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
if (PZVAL_IS_LOCKED(value)) { if (PZVAL_IS_LOCKED(value)) {
zval *orig_value = value; zval *orig_value = value;
value = ALLOC_ZVAL();
ALLOC_ZVAL(value);
*value = *orig_value; *value = *orig_value;
value->refcount=0; value->refcount=0;
zval_copy_ctor(value); zval_copy_ctor(value);
@ -392,7 +392,7 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
if (PZVAL_IS_LOCKED(value)) { if (PZVAL_IS_LOCKED(value)) {
zval *orig_value = value; zval *orig_value = value;
value = ALLOC_ZVAL();
ALLOC_ZVAL(value);
*value = *orig_value; *value = *orig_value;
value->refcount=0; value->refcount=0;
zval_copy_ctor(value); zval_copy_ctor(value);
@ -401,7 +401,8 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
/* break missing intentionally */ /* break missing intentionally */
case IS_CONST: case IS_CONST:
if (PZVAL_IS_REF(value) && value->refcount > 0) { if (PZVAL_IS_REF(value) && value->refcount > 0) {
variable_ptr = *variable_ptr_ptr = ALLOC_ZVAL();
ALLOC_ZVAL(variable_ptr);
*variable_ptr_ptr = variable_ptr;
*variable_ptr = *value; *variable_ptr = *value;
zval_copy_ctor(variable_ptr); zval_copy_ctor(variable_ptr);
variable_ptr->refcount=1; variable_ptr->refcount=1;
@ -411,7 +412,7 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
value->refcount++; value->refcount++;
break; break;
case IS_TMP_VAR: case IS_TMP_VAR:
(*variable_ptr_ptr) = ALLOC_ZVAL();
ALLOC_ZVAL(*variable_ptr_ptr);
value->refcount=1; value->refcount=1;
**variable_ptr_ptr = *value; **variable_ptr_ptr = *value;
break; break;
@ -661,7 +662,8 @@ static inline void zend_fetch_dimension_address(znode *result, znode *op1, znode
if (!PZVAL_IS_REF(container)) { if (!PZVAL_IS_REF(container)) {
container->refcount--; container->refcount--;
if (container->refcount>0) { if (container->refcount>0) {
container = *container_ptr = ALLOC_ZVAL();
ALLOC_ZVAL(container);
*container_ptr = container;
container->is_ref=0; container->is_ref=0;
} }
container->refcount=1; container->refcount=1;
@ -675,7 +677,7 @@ static inline void zend_fetch_dimension_address(znode *result, znode *op1, znode
case IS_ARRAY: case IS_ARRAY:
if ((type==BP_VAR_W || type==BP_VAR_RW) && container->refcount>1 && !PZVAL_IS_REF(container)) { if ((type==BP_VAR_W || type==BP_VAR_RW) && container->refcount>1 && !PZVAL_IS_REF(container)) {
container->refcount--; container->refcount--;
*container_ptr = ALLOC_ZVAL();
ALLOC_ZVAL(*container_ptr);
**container_ptr = *container; **container_ptr = *container;
container = *container_ptr; container = *container_ptr;
INIT_PZVAL(container); INIT_PZVAL(container);
@ -836,7 +838,8 @@ static inline void zend_fetch_property_address(znode *result, znode *op1, znode
if (!PZVAL_IS_REF(container)) { if (!PZVAL_IS_REF(container)) {
container->refcount--; container->refcount--;
if (container->refcount>0) { if (container->refcount>0) {
container = *container_ptr = ALLOC_ZVAL();
ALLOC_ZVAL(container);
*container_ptr = container;
container->is_ref=0; container->is_ref=0;
} }
container->refcount=1; container->refcount=1;
@ -863,7 +866,7 @@ static inline void zend_fetch_property_address(znode *result, znode *op1, znode
if ((type==BP_VAR_W || type==BP_VAR_RW) && container->refcount>1 && !PZVAL_IS_REF(container)) { if ((type==BP_VAR_W || type==BP_VAR_RW) && container->refcount>1 && !PZVAL_IS_REF(container)) {
container->refcount--; container->refcount--;
*container_ptr = ALLOC_ZVAL();
ALLOC_ZVAL(*container_ptr);
**container_ptr = *container; **container_ptr = *container;
container = *container_ptr; container = *container_ptr;
INIT_PZVAL(container); INIT_PZVAL(container);
@ -959,8 +962,9 @@ void execute(zend_op_array *op_array ELS_DC)
#endif #endif
if (op_array->uses_globals) { if (op_array->uses_globals) {
zval *globals = ALLOC_ZVAL();
zval *globals;
ALLOC_ZVAL(globals);
globals->refcount=1; globals->refcount=1;
globals->is_ref=1; globals->is_ref=1;
globals->type = IS_ARRAY; globals->type = IS_ARRAY;
@ -1089,7 +1093,7 @@ binary_assign_op_addr: {
zval *orig_var=*var_ptr; zval *orig_var=*var_ptr;
(*var_ptr)->refcount--; (*var_ptr)->refcount--;
*var_ptr = ALLOC_ZVAL();
ALLOC_ZVAL(*var_ptr);
**var_ptr = *orig_var; **var_ptr = *orig_var;
zendi_zval_copy_ctor(**var_ptr); zendi_zval_copy_ctor(**var_ptr);
(*var_ptr)->refcount=1; (*var_ptr)->refcount=1;
@ -1134,7 +1138,7 @@ binary_assign_op_addr: {
zval *orig_var = *var_ptr; zval *orig_var = *var_ptr;
(*var_ptr)->refcount--; (*var_ptr)->refcount--;
*var_ptr = ALLOC_ZVAL();
ALLOC_ZVAL(*var_ptr);
**var_ptr = *orig_var; **var_ptr = *orig_var;
zendi_zval_copy_ctor(**var_ptr); zendi_zval_copy_ctor(**var_ptr);
(*var_ptr)->refcount=1; (*var_ptr)->refcount=1;
@ -1502,7 +1506,7 @@ do_fcall_common:
Ts[opline->result.u.var].var.ptr_ptr = &Ts[opline->result.u.var].var.ptr; Ts[opline->result.u.var].var.ptr_ptr = &Ts[opline->result.u.var].var.ptr;
if (function_state.function->type==ZEND_INTERNAL_FUNCTION) { if (function_state.function->type==ZEND_INTERNAL_FUNCTION) {
Ts[opline->result.u.var].var.ptr = ALLOC_ZVAL();
ALLOC_ZVAL(Ts[opline->result.u.var].var.ptr);
INIT_ZVAL(*(Ts[opline->result.u.var].var.ptr)); INIT_ZVAL(*(Ts[opline->result.u.var].var.ptr));
((zend_internal_function *) function_state.function)->handler(opline->extended_value, Ts[opline->result.u.var].var.ptr, &EG(regular_list), &EG(persistent_list), object.ptr, return_value_used); ((zend_internal_function *) function_state.function)->handler(opline->extended_value, Ts[opline->result.u.var].var.ptr, &EG(regular_list), &EG(persistent_list), object.ptr, return_value_used);
if (object.ptr) { if (object.ptr) {
@ -1546,7 +1550,7 @@ do_fcall_common:
zend_execute(EG(active_op_array) ELS_CC); zend_execute(EG(active_op_array) ELS_CC);
if (return_value_used && !Ts[opline->result.u.var].var.ptr) { if (return_value_used && !Ts[opline->result.u.var].var.ptr) {
Ts[opline->result.u.var].var.ptr = ALLOC_ZVAL();
ALLOC_ZVAL(Ts[opline->result.u.var].var.ptr);
INIT_ZVAL(*Ts[opline->result.u.var].var.ptr); INIT_ZVAL(*Ts[opline->result.u.var].var.ptr);
} else if (!return_value_used && Ts[opline->result.u.var].var.ptr) { } else if (!return_value_used && Ts[opline->result.u.var].var.ptr) {
zval_ptr_dtor(&Ts[opline->result.u.var].var.ptr); zval_ptr_dtor(&Ts[opline->result.u.var].var.ptr);
@ -1563,7 +1567,7 @@ do_fcall_common:
} }
EG(active_symbol_table) = calling_symbol_table; EG(active_symbol_table) = calling_symbol_table;
} else { /* ZEND_OVERLOADED_FUNCTION */ } else { /* ZEND_OVERLOADED_FUNCTION */
Ts[opline->result.u.var].var.ptr = ALLOC_ZVAL();
ALLOC_ZVAL(Ts[opline->result.u.var].var.ptr);
INIT_ZVAL(*(Ts[opline->result.u.var].var.ptr)); INIT_ZVAL(*(Ts[opline->result.u.var].var.ptr));
call_overloaded_function(opline->extended_value, Ts[opline->result.u.var].var.ptr, &EG(regular_list), &EG(persistent_list) ELS_CC); call_overloaded_function(opline->extended_value, Ts[opline->result.u.var].var.ptr, &EG(regular_list), &EG(persistent_list) ELS_CC);
efree(fbc); efree(fbc);
@ -1602,7 +1606,7 @@ do_fcall_common:
if (!EG(free_op1)) { /* Not a temp var */ if (!EG(free_op1)) { /* Not a temp var */
if (PZVAL_IS_REF(retval_ptr) && retval_ptr->refcount > 0) { if (PZVAL_IS_REF(retval_ptr) && retval_ptr->refcount > 0) {
*(EG(return_value_ptr_ptr)) = ALLOC_ZVAL();
ALLOC_ZVAL(*(EG(return_value_ptr_ptr)));
**EG(return_value_ptr_ptr) = *retval_ptr; **EG(return_value_ptr_ptr) = *retval_ptr;
(*EG(return_value_ptr_ptr))->is_ref = 0; (*EG(return_value_ptr_ptr))->is_ref = 0;
(*EG(return_value_ptr_ptr))->refcount = 1; (*EG(return_value_ptr_ptr))->refcount = 1;
@ -1612,7 +1616,7 @@ do_fcall_common:
retval_ptr->refcount++; retval_ptr->refcount++;
} }
} else { } else {
*(EG(return_value_ptr_ptr))= ALLOC_ZVAL();
ALLOC_ZVAL(*(EG(return_value_ptr_ptr)));
**EG(return_value_ptr_ptr) = *retval_ptr; **EG(return_value_ptr_ptr) = *retval_ptr;
(*EG(return_value_ptr_ptr))->refcount = 1; (*EG(return_value_ptr_ptr))->refcount = 1;
(*EG(return_value_ptr_ptr))->is_ref = 0; (*EG(return_value_ptr_ptr))->is_ref = 0;
@ -1632,8 +1636,9 @@ do_fcall_common:
zend_error(E_ERROR, "Cannot pass parameter %d by reference", opline->op2.u.opline_num); zend_error(E_ERROR, "Cannot pass parameter %d by reference", opline->op2.u.opline_num);
} }
{ {
zval *valptr = ALLOC_ZVAL();
zval *valptr;
ALLOC_ZVAL(valptr);
*valptr = Ts[opline->op1.u.var].tmp_var; *valptr = Ts[opline->op1.u.var].tmp_var;
INIT_PZVAL(valptr); INIT_PZVAL(valptr);
zend_ptr_stack_push(&EG(argument_stack), valptr); zend_ptr_stack_push(&EG(argument_stack), valptr);
@ -1651,13 +1656,13 @@ do_fcall_common:
RESUME_GARBAGE(); RESUME_GARBAGE();
if (varptr == &EG(uninitialized_zval)) { if (varptr == &EG(uninitialized_zval)) {
varptr = ALLOC_ZVAL();
ALLOC_ZVAL(varptr);
INIT_ZVAL(*varptr); INIT_ZVAL(*varptr);
varptr->refcount = 0; varptr->refcount = 0;
} else if (PZVAL_IS_REF(varptr)) { } else if (PZVAL_IS_REF(varptr)) {
zval *original_var = varptr; zval *original_var = varptr;
varptr = ALLOC_ZVAL();
ALLOC_ZVAL(varptr);
*varptr = *original_var; *varptr = *original_var;
varptr->is_ref = 0; varptr->is_ref = 0;
varptr->refcount = 0; varptr->refcount = 0;
@ -1682,7 +1687,7 @@ send_by_ref:
/* code to break away this variable */ /* code to break away this variable */
if (varptr->refcount>1) { if (varptr->refcount>1) {
varptr->refcount--; varptr->refcount--;
*varptr_ptr = ALLOC_ZVAL();
ALLOC_ZVAL(*varptr_ptr);
**varptr_ptr = *varptr; **varptr_ptr = *varptr;
varptr = *varptr_ptr; varptr = *varptr_ptr;
varptr->refcount = 1; varptr->refcount = 1;
@ -1721,9 +1726,10 @@ send_by_ref:
break; break;
} }
if (opline->op2.u.constant.type == IS_CONSTANT) { if (opline->op2.u.constant.type == IS_CONSTANT) {
zval *default_value = ALLOC_ZVAL();
zval *default_value;
zval tmp; zval tmp;
ALLOC_ZVAL(default_value);
*default_value = opline->op2.u.constant; *default_value = opline->op2.u.constant;
if (!zend_get_constant(default_value->value.str.val, default_value->value.str.len, &tmp)) { if (!zend_get_constant(default_value->value.str.val, default_value->value.str.len, &tmp)) {
default_value->type = IS_STRING; default_value->type = IS_STRING;
@ -1886,8 +1892,9 @@ send_by_ref:
} }
} }
if (opline->op1.op_type == IS_TMP_VAR) { /* temporary variable */ if (opline->op1.op_type == IS_TMP_VAR) { /* temporary variable */
zval *new_expr = ALLOC_ZVAL();
zval *new_expr;
ALLOC_ZVAL(new_expr);
*new_expr = *expr_ptr; *new_expr = *expr_ptr;
expr_ptr = new_expr; expr_ptr = new_expr;
INIT_PZVAL(expr_ptr); INIT_PZVAL(expr_ptr);
@ -1900,8 +1907,9 @@ send_by_ref:
} }
expr_ptr->refcount++; expr_ptr->refcount++;
} else if (PZVAL_IS_REF(expr_ptr)) { } else if (PZVAL_IS_REF(expr_ptr)) {
zval *new_expr = ALLOC_ZVAL();
zval *new_expr;
ALLOC_ZVAL(new_expr);
*new_expr = *expr_ptr; *new_expr = *expr_ptr;
expr_ptr = new_expr; expr_ptr = new_expr;
zendi_zval_copy_ctor(*expr_ptr); zendi_zval_copy_ctor(*expr_ptr);
@ -1994,7 +2002,7 @@ send_by_ref:
} }
} else { /* return value is used */ } else { /* return value is used */
if (!Ts[opline->result.u.var].var.ptr) { /* there was no return statement */ if (!Ts[opline->result.u.var].var.ptr) { /* there was no return statement */
Ts[opline->result.u.var].var.ptr = ALLOC_ZVAL();
ALLOC_ZVAL(Ts[opline->result.u.var].var.ptr);
INIT_PZVAL(Ts[opline->result.u.var].var.ptr); INIT_PZVAL(Ts[opline->result.u.var].var.ptr);
Ts[opline->result.u.var].var.ptr->value.lval = 1; Ts[opline->result.u.var].var.ptr->value.lval = 1;
Ts[opline->result.u.var].var.ptr->type = IS_LONG; Ts[opline->result.u.var].var.ptr->type = IS_LONG;
@ -2008,7 +2016,7 @@ send_by_ref:
efree(new_op_array); efree(new_op_array);
} else { } else {
if (return_value_used) { if (return_value_used) {
Ts[opline->result.u.var].var.ptr = ALLOC_ZVAL();
ALLOC_ZVAL(Ts[opline->result.u.var].var.ptr);
INIT_ZVAL(*Ts[opline->result.u.var].var.ptr); INIT_ZVAL(*Ts[opline->result.u.var].var.ptr);
} }
} }
@ -2104,7 +2112,7 @@ send_by_ref:
(*value)->refcount++; (*value)->refcount++;
zend_hash_index_update(result->value.ht, 0, value, sizeof(zval *), NULL); zend_hash_index_update(result->value.ht, 0, value, sizeof(zval *), NULL);
key = ALLOC_ZVAL();
ALLOC_ZVAL(key);
INIT_PZVAL(key); INIT_PZVAL(key);
switch (zend_hash_get_current_key(array->value.ht, &str_key, &int_key)) { switch (zend_hash_get_current_key(array->value.ht, &str_key, &int_key)) {
case HASH_KEY_IS_STRING: case HASH_KEY_IS_STRING:

9
Zend/zend_execute_API.c

@ -344,7 +344,7 @@ int call_user_function_ex(HashTable *function_table, zval *object, zval *functio
if (no_separation) { if (no_separation) {
return FAILURE; return FAILURE;
} }
new_zval = ALLOC_ZVAL();
ALLOC_ZVAL(new_zval);
*new_zval = **params[i]; *new_zval = **params[i];
zval_copy_ctor(new_zval); zval_copy_ctor(new_zval);
new_zval->refcount = 1; new_zval->refcount = 1;
@ -358,7 +358,7 @@ int call_user_function_ex(HashTable *function_table, zval *object, zval *functio
(*params[i])->refcount++; (*params[i])->refcount++;
param = *params[i]; param = *params[i];
} else { } else {
param = ALLOC_ZVAL();
ALLOC_ZVAL(param);
*param = **(params[i]); *param = **(params[i]);
INIT_PZVAL(param); INIT_PZVAL(param);
} }
@ -373,8 +373,9 @@ int call_user_function_ex(HashTable *function_table, zval *object, zval *functio
EG(active_symbol_table) = (HashTable *) emalloc(sizeof(HashTable)); EG(active_symbol_table) = (HashTable *) emalloc(sizeof(HashTable));
zend_hash_init(EG(active_symbol_table), 0, NULL, ZVAL_PTR_DTOR, 0); zend_hash_init(EG(active_symbol_table), 0, NULL, ZVAL_PTR_DTOR, 0);
if (object) { if (object) {
zval *dummy = ALLOC_ZVAL(), **this_ptr;
zval *dummy, **this_ptr;
ALLOC_ZVAL(dummy);
INIT_ZVAL(*dummy); INIT_ZVAL(*dummy);
zend_hash_update_ptr(EG(active_symbol_table), "this", sizeof("this"), dummy, sizeof(zval *), (void **) &this_ptr); zend_hash_update_ptr(EG(active_symbol_table), "this", sizeof("this"), dummy, sizeof(zval *), (void **) &this_ptr);
@ -494,7 +495,7 @@ ZEND_API inline void zend_assign_to_variable_reference(znode *result, zval **var
/* break it away */ /* break it away */
value_ptr->refcount--; value_ptr->refcount--;
if (value_ptr->refcount>0) { if (value_ptr->refcount>0) {
*value_ptr_ptr = ALLOC_ZVAL();
ALLOC_ZVAL(*value_ptr_ptr);
**value_ptr_ptr = *value_ptr; **value_ptr_ptr = *value_ptr;
value_ptr = *value_ptr_ptr; value_ptr = *value_ptr_ptr;
zendi_zval_copy_ctor(*value_ptr); zendi_zval_copy_ctor(*value_ptr);

3
Zend/zend_operators.c

@ -339,8 +339,9 @@ ZEND_API void convert_to_string(zval *op)
static void convert_scalar_to_array(zval *op, int type) static void convert_scalar_to_array(zval *op, int type)
{ {
zval *entry = ALLOC_ZVAL();
zval *entry;
ALLOC_ZVAL(entry);
*entry = *op; *entry = *op;
INIT_PZVAL(entry); INIT_PZVAL(entry);

2
ext/dav/dav.c

@ -192,7 +192,7 @@ dav_call_handler(char *funcName, int argc, pval **argv)
HashTable *function_table; HashTable *function_table;
func = php3i_string_pval(funcName); func = php3i_string_pval(funcName);
retval = ALLOC_ZVAL();
ALLOC_ZVAL(retval);
function_table = php3i_get_function_table(); function_table = php3i_get_function_table();
if (call_user_function(function_table, NULL, func, retval, argc, argv) == FAILURE) { if (call_user_function(function_table, NULL, func, retval, argc, argv) == FAILURE) {
php3tls_pval_destructor(retval); php3tls_pval_destructor(retval);

2
ext/hyperwave/hw.c

@ -1175,7 +1175,7 @@ php_printf("%s\n", ptr);
while(attrname != NULL) { while(attrname != NULL) {
char *name; char *name;
user_arr = ALLOC_ZVAL();
ALLOC_ZVAL(user_arr);
if (array_init(user_arr) == FAILURE) { if (array_init(user_arr) == FAILURE) {
efree(object); efree(object);
RETURN_FALSE; RETURN_FALSE;

2
ext/java/java.c

@ -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); zend_hash_init(presult->value.obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
}; };
handle = ALLOC_ZVAL();
ALLOC_ZVAL(handle);
handle->type = IS_LONG; handle->type = IS_LONG;
handle->value.lval = handle->value.lval =
zend_list_insert((*jenv)->NewGlobalRef(jenv,value), le_jobject); zend_list_insert((*jenv)->NewGlobalRef(jenv,value), le_jobject);

2
ext/odbc/php_odbc.c

@ -1096,7 +1096,7 @@ PHP_FUNCTION(odbc_fetch_into)
result->fetched++; result->fetched++;
for(i = 0; i < result->numcols; i++) { for(i = 0; i < result->numcols; i++) {
tmp = ALLOC_ZVAL();
ALLOC_ZVAL(tmp);
tmp->refcount = 1; tmp->refcount = 1;
tmp->type = IS_STRING; tmp->type = IS_STRING;
tmp->value.str.len = 0; tmp->value.str.len = 0;

4
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) { if (global && subpats_order_val == PREG_PATTERN_ORDER) {
match_sets = (zval **)emalloc(num_subpats * sizeof(zval *)); match_sets = (zval **)emalloc(num_subpats * sizeof(zval *));
for (i=0; i<num_subpats; i++) { for (i=0; i<num_subpats; i++) {
match_sets[i] = ALLOC_ZVAL();
ALLOC_ZVAL(match_sets[i]);
array_init(match_sets[i]); array_init(match_sets[i]);
INIT_PZVAL(match_sets[i]); INIT_PZVAL(match_sets[i]);
} }
@ -441,7 +441,7 @@ static void _pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global)
} }
else { else {
/* Allocate the result set array */ /* Allocate the result set array */
result_set = ALLOC_ZVAL();
ALLOC_ZVAL(result_set);
array_init(result_set); array_init(result_set);
INIT_PZVAL(result_set); INIT_PZVAL(result_set);

4
ext/rpc/com/COM.c

@ -416,7 +416,7 @@ static void php_variant_to_pval(VARIANTARG *var_arg, pval *pval_arg, int persist
pval_arg->refcount=1; pval_arg->refcount=1;
zend_hash_init(pval_arg->value.obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0); zend_hash_init(pval_arg->value.obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
handle = ALLOC_ZVAL();
ALLOC_ZVAL(handle);
handle->type = IS_LONG; handle->type = IS_LONG;
handle->value.lval = zend_list_insert(var_arg->pdispVal, le_idispatch); handle->value.lval = zend_list_insert(var_arg->pdispVal, le_idispatch);
pval_copy_constructor(handle); pval_copy_constructor(handle);
@ -915,7 +915,7 @@ void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_r
var_reset(object); var_reset(object);
return; return;
} }
object_handle = ALLOC_ZVAL();
ALLOC_ZVAL(object_handle);
*object_handle = *return_value; *object_handle = *return_value;
pval_copy_constructor(object_handle); pval_copy_constructor(object_handle);
INIT_PZVAL(object_handle); INIT_PZVAL(object_handle);

2
ext/rpc/java/java.c

@ -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); zend_hash_init(presult->value.obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
}; };
handle = ALLOC_ZVAL();
ALLOC_ZVAL(handle);
handle->type = IS_LONG; handle->type = IS_LONG;
handle->value.lval = handle->value.lval =
zend_list_insert((*jenv)->NewGlobalRef(jenv,value), le_jobject); zend_list_insert((*jenv)->NewGlobalRef(jenv,value), le_jobject);

2
ext/session/session.c

@ -176,7 +176,7 @@ static void php_set_session_var(char *name, size_t namelen,
PLS_FETCH(); PLS_FETCH();
ELS_FETCH(); ELS_FETCH();
state_val_copy = ALLOC_ZVAL();
ALLOC_ZVAL(state_val_copy);
*state_val_copy = *state_val; *state_val_copy = *state_val;
zval_copy_ctor(state_val_copy); zval_copy_ctor(state_val_copy);
state_val_copy->refcount = 0; state_val_copy->refcount = 0;

2
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, if (zend_hash_find(eg_active_symbol_table, entry->value.str.val,
entry->value.str.len+1, (void **)&value_ptr) != FAILURE) { entry->value.str.len+1, (void **)&value_ptr) != FAILURE) {
value = *value_ptr; value = *value_ptr;
data = ALLOC_ZVAL();
ALLOC_ZVAL(data);
*data = *value; *data = *value;
zval_copy_ctor(data); zval_copy_ctor(data);
INIT_PZVAL(data); INIT_PZVAL(data);

2
ext/standard/iptc.c

@ -356,7 +356,7 @@ PHP_FUNCTION(iptcparse)
} }
if (zend_hash_find(return_value->value.ht,key,strlen(key) + 1,(void **) &element) == FAILURE) { if (zend_hash_find(return_value->value.ht,key,strlen(key) + 1,(void **) &element) == FAILURE) {
values = ALLOC_ZVAL();
ALLOC_ZVAL(values);
INIT_PZVAL(values); INIT_PZVAL(values);
if (array_init(values) == FAILURE) { if (array_init(values) == FAILURE) {
php_error(E_ERROR, "Unable to initialize array"); php_error(E_ERROR, "Unable to initialize array");

6
ext/standard/post.c

@ -112,7 +112,7 @@ void php_parse_gpc_data(char *val, char *var, pval *track_vars_array ELS_DC PLS_
} }
/* Create the element */ /* Create the element */
array_element = ALLOC_ZVAL();
ALLOC_ZVAL(array_element);
INIT_PZVAL(array_element); INIT_PZVAL(array_element);
array_element->value.str.val = val; array_element->value.str.val = val;
array_element->value.str.len = val_len; 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_GET:
case PARSE_COOKIE: case PARSE_COOKIE:
if (PG(track_vars)) { if (PG(track_vars)) {
array_ptr = ALLOC_ZVAL();
ALLOC_ZVAL(array_ptr);
array_init(array_ptr); array_init(array_ptr);
INIT_PZVAL(array_ptr); INIT_PZVAL(array_ptr);
switch (arg) { 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"))) { if((NULL != SG(request_info).content_type) && (0 == strcmp(SG(request_info).content_type, "application/vnd.fdf"))) {
pval *tmp; pval *tmp;
tmp = ALLOC_ZVAL();
ALLOC_ZVAL(tmp);
tmp->value.str.len = SG(request_info).post_data_length; 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->value.str.val = estrndup(SG(request_info).post_data, SG(request_info).post_data_length);
tmp->type = IS_STRING; tmp->type = IS_STRING;

16
ext/standard/var.c

@ -96,8 +96,9 @@ void php_var_dump(pval **struc, int level)
} }
switch (i) { switch (i) {
case HASH_KEY_IS_LONG:{ case HASH_KEY_IS_LONG:{
pval *d = ALLOC_ZVAL();
pval *d;
ALLOC_ZVAL(d);
d->type = IS_LONG; d->type = IS_LONG;
d->value.lval = index; d->value.lval = index;
php_var_dump(&d, level + 2); php_var_dump(&d, level + 2);
@ -106,8 +107,9 @@ void php_var_dump(pval **struc, int level)
break; break;
case HASH_KEY_IS_STRING:{ case HASH_KEY_IS_STRING:{
pval *d = ALLOC_ZVAL();
pval *d;
ALLOC_ZVAL(d);
d->type = IS_STRING; d->type = IS_STRING;
d->value.str.val = key; d->value.str.val = key;
d->value.str.len = strlen(key); d->value.str.len = strlen(key);
@ -253,14 +255,14 @@ void php_var_serialize(pval *buf, pval **struc)
switch (i) { switch (i) {
case HASH_KEY_IS_LONG: case HASH_KEY_IS_LONG:
d = ALLOC_ZVAL();
ALLOC_ZVAL(d);
d->type = IS_LONG; d->type = IS_LONG;
d->value.lval = index; d->value.lval = index;
php_var_serialize(buf, &d); php_var_serialize(buf, &d);
efree(d); efree(d);
break; break;
case HASH_KEY_IS_STRING: case HASH_KEY_IS_STRING:
d = ALLOC_ZVAL();
ALLOC_ZVAL(d);
d->type = IS_STRING; d->type = IS_STRING;
d->value.str.val = key; d->value.str.val = key;
d->value.str.len = strlen(key); d->value.str.len = strlen(key);
@ -431,9 +433,11 @@ int php_var_unserialize(pval **rval, const char **p, const char *max)
return 0; return 0;
} }
for ((*p) += 2; **p && **p != '}' && i > 0; i--) { for ((*p) += 2; **p && **p != '}' && i > 0; i--) {
pval *key = ALLOC_ZVAL();
pval *data = ALLOC_ZVAL();
pval *key;
pval *data;
ALLOC_ZVAL(key);
ALLOC_ZVAL(data);
if (!php_var_unserialize(&key, p, max)) { if (!php_var_unserialize(&key, p, max)) {
zval_dtor(key); zval_dtor(key);
efree(key); efree(key);

4
ext/sybase_ct/php_sybase_ct.c

@ -1224,7 +1224,7 @@ PHP_FUNCTION(sybase_fetch_row)
array_init(return_value); array_init(return_value);
for (i=0; i<result->num_fields; i++) { for (i=0; i<result->num_fields; i++) {
field_content = ALLOC_ZVAL();
ALLOC_ZVAL(field_content);
*field_content = result->data[result->cur_row][i]; *field_content = result->data[result->cur_row][i];
INIT_PZVAL(field_content); INIT_PZVAL(field_content);
pval_copy_constructor(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++) { for (i=0; i<result->num_fields; i++) {
tmp = ALLOC_ZVAL();
ALLOC_ZVAL(tmp);
*tmp = result->data[result->cur_row][i]; *tmp = result->data[result->cur_row][i];
INIT_PZVAL(tmp); INIT_PZVAL(tmp);
if (PG(magic_quotes_runtime) && tmp->type == IS_STRING) { if (PG(magic_quotes_runtime) && tmp->type == IS_STRING) {

8
ext/wddx/wddx.c

@ -468,7 +468,7 @@ static void _php_wddx_push_element(void *user_data, const char *name, const char
} else } else
ent.varname = NULL; ent.varname = NULL;
ent.data = ALLOC_ZVAL();
ALLOC_ZVAL(ent.data);
ent.data->value.str.val = NULL; ent.data->value.str.val = NULL;
ent.data->value.str.len = 0; ent.data->value.str.len = 0;
INIT_PZVAL(ent.data); INIT_PZVAL(ent.data);
@ -492,7 +492,7 @@ static void _php_wddx_push_element(void *user_data, const char *name, const char
} else } else
ent.varname = NULL; ent.varname = NULL;
ent.data = ALLOC_ZVAL();
ALLOC_ZVAL(ent.data);
INIT_PZVAL(ent.data); INIT_PZVAL(ent.data);
wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));
} else if (!strcmp(name, EL_ARRAY)) { } 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 } else
ent.varname = NULL; ent.varname = NULL;
ent.data = ALLOC_ZVAL();
ALLOC_ZVAL(ent.data);
array_init(ent.data); array_init(ent.data);
INIT_PZVAL(ent.data); INIT_PZVAL(ent.data);
wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); 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 } else
ent.varname = NULL; ent.varname = NULL;
ent.data = ALLOC_ZVAL();
ALLOC_ZVAL(ent.data);
array_init(ent.data); array_init(ent.data);
INIT_PZVAL(ent.data); INIT_PZVAL(ent.data);
wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));

18
main/main.c

@ -446,7 +446,7 @@ PHPAPI void php_error(int type, const char *format,...)
va_end(args); va_end(args);
buffer[sizeof(buffer) - 1] = 0; buffer[sizeof(buffer) - 1] = 0;
tmp = ALLOC_ZVAL();
ALLOC_ZVAL(tmp);
INIT_PZVAL(tmp); INIT_PZVAL(tmp);
tmp->value.str.val = (char *) estrndup(buffer, size); tmp->value.str.val = (char *) estrndup(buffer, size);
tmp->value.str.len = size; tmp->value.str.len = size;
@ -1079,7 +1079,7 @@ static int zend_hash_environment(PLS_D ELS_DC SLS_DC)
continue; continue;
} }
t = estrndup(*env, p - *env); t = estrndup(*env, p - *env);
tmp = ALLOC_ZVAL();
ALLOC_ZVAL(tmp);
tmp->value.str.len = strlen(p + 1); tmp->value.str.len = strlen(p + 1);
tmp->value.str.val = estrndup(p + 1, tmp->value.str.len); tmp->value.str.val = estrndup(p + 1, tmp->value.str.len);
tmp->type = IS_STRING; 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++) { for (i = 0; i < arr->nelts; i++) {
len = strlen(elts[i].key); len = strlen(elts[i].key);
t = elts[i].key; t = elts[i].key;
tmp = ALLOC_ZVAL();
ALLOC_ZVAL(tmp);
if (elts[i].val) { if (elts[i].val) {
tmp->value.str.len = strlen(elts[i].val); tmp->value.str.len = strlen(elts[i].val);
tmp->value.str.val = estrndup(elts[i].val, tmp->value.str.len); 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++; (*tmp_ptr)->refcount++;
zend_hash_update(&EG(symbol_table), "PATH_TRANSLATED", sizeof("PATH_TRANSLATED"), tmp_ptr, sizeof(pval *), NULL); zend_hash_update(&EG(symbol_table), "PATH_TRANSLATED", sizeof("PATH_TRANSLATED"), tmp_ptr, sizeof(pval *), NULL);
} }
tmp = ALLOC_ZVAL();
ALLOC_ZVAL(tmp);
tmp->value.str.len = strlen(((request_rec *) SG(server_context))->uri); 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->value.str.val = estrndup(((request_rec *) SG(server_context))->uri, tmp->value.str.len);
INIT_PZVAL(tmp); INIT_PZVAL(tmp);
@ -1130,7 +1130,7 @@ static int zend_hash_environment(PLS_D ELS_DC SLS_DC)
char *pi; char *pi;
#if FORCE_CGI_REDIRECT #if FORCE_CGI_REDIRECT
pi = SG(request_info).request_uri; pi = SG(request_info).request_uri;
tmp = ALLOC_ZVAL();
ALLOC_ZVAL(tmp);
tmp->value.str.val = emalloc(((pi)?strlen(pi):0) + 1); 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->value.str.len = php_sprintf(tmp->value.str.val, "%s", (pi ? pi : "")); /* SAFE */
tmp->type = IS_STRING; tmp->type = IS_STRING;
@ -1148,7 +1148,7 @@ static int zend_hash_environment(PLS_D ELS_DC SLS_DC)
l -= strlen(pi); l -= strlen(pi);
pi = NULL; pi = NULL;
} }
tmp = ALLOC_ZVAL();
ALLOC_ZVAL(tmp);
tmp->value.str.val = emalloc(l + 1); 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->value.str.len = php_sprintf(tmp->value.str.val, "%s%s", (sn ? sn : ""), (pi ? pi : "")); /* SAFE */
tmp->type = IS_STRING; tmp->type = IS_STRING;
@ -1171,7 +1171,7 @@ void _php_build_argv(char *s ELS_DC)
int count = 0; int count = 0;
char *ss, *space; char *ss, *space;
arr = ALLOC_ZVAL();
ALLOC_ZVAL(arr);
arr->value.ht = (HashTable *) emalloc(sizeof(HashTable)); arr->value.ht = (HashTable *) emalloc(sizeof(HashTable));
if (zend_hash_init(arr->value.ht, 0, NULL, ZVAL_PTR_DTOR, 0) == FAILURE) { if (zend_hash_init(arr->value.ht, 0, NULL, ZVAL_PTR_DTOR, 0) == FAILURE) {
php_error(E_WARNING, "Unable to create argv array"); php_error(E_WARNING, "Unable to create argv array");
@ -1188,7 +1188,7 @@ void _php_build_argv(char *s ELS_DC)
*space = '\0'; *space = '\0';
} }
/* auto-type */ /* auto-type */
tmp = ALLOC_ZVAL();
ALLOC_ZVAL(tmp);
tmp->type = IS_STRING; tmp->type = IS_STRING;
tmp->value.str.len = strlen(ss); tmp->value.str.len = strlen(ss);
tmp->value.str.val = estrndup(ss, tmp->value.str.len); tmp->value.str.val = estrndup(ss, tmp->value.str.len);
@ -1206,7 +1206,7 @@ void _php_build_argv(char *s ELS_DC)
ss = space; ss = space;
} }
} }
tmp = ALLOC_ZVAL();
ALLOC_ZVAL(tmp);
tmp->value.lval = count; tmp->value.lval = count;
tmp->type = IS_LONG; tmp->type = IS_LONG;
INIT_PZVAL(tmp); INIT_PZVAL(tmp);

2
main/rfc1867.c

@ -45,7 +45,7 @@ static void php_mime_split(char *buf, int cnt, char *boundary)
PLS_FETCH(); PLS_FETCH();
if (PG(track_vars)) { if (PG(track_vars)) {
http_post_vars = ALLOC_ZVAL();
ALLOC_ZVAL(http_post_vars);
array_init(http_post_vars); array_init(http_post_vars);
INIT_PZVAL(http_post_vars); INIT_PZVAL(http_post_vars);

3
sapi/isapi/php4isapi.c

@ -407,8 +407,9 @@ static void hash_isapi_variables(ELS_D SLS_DC)
if (colon) { if (colon) {
char *value = colon+1; char *value = colon+1;
zval *entry = ALLOC_ZVAL();
zval *entry;
ALLOC_ZVAL(entry);
while (*value==' ') { while (*value==' ') {
value++; value++;
} }

Loading…
Cancel
Save