]> granicus.if.org Git - php/commitdiff
- Functions whose return values aren't used have them freed in DO_FCALL
authorAndi Gutmans <andi@php.net>
Fri, 19 Nov 1999 16:55:25 +0000 (16:55 +0000)
committerAndi Gutmans <andi@php.net>
Fri, 19 Nov 1999 16:55:25 +0000 (16:55 +0000)
  and don't need a special ZEND_FREE opcode following them anymore

Zend/zend.h
Zend/zend_execute.c

index 52e74c86485acc8c70b5d0e907fa4ccb4d152613..429f9fae7911df265d54167a035ba0df3acfb73d 100644 (file)
@@ -96,7 +96,7 @@ typedef unsigned char zend_bool;
 #include "zend_hash.h"
 #include "zend_llist.h"
 
-#define INTERNAL_FUNCTION_PARAMETERS int ht, zval *return_value, HashTable *list, HashTable *plist, zval *this_ptr, char return_value_used
+#define INTERNAL_FUNCTION_PARAMETERS int ht, zval *return_value, HashTable *list, HashTable *plist, zval *this_ptr, int return_value_used
 #define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, list, plist, this_ptr, return_value_used
 
 /*
index b4baddcb7cc0f4e003e78f558fa63cd637b5f644..2256b1bf378ec54af36b057123ce48511880ba58 100644 (file)
@@ -1464,17 +1464,15 @@ overloaded_function_call_cont:
 do_fcall_common:
                                {
                                        zval *original_return_value;
+                                       int return_value_not_used = (opline->result.u.EA.type & EXT_TYPE_UNUSED);
 
                                        zend_ptr_stack_push(&EG(argument_stack), (void *) opline->extended_value);
                                        if (function_state.function->type==ZEND_INTERNAL_FUNCTION) {
                                                var_uninit(&Ts[opline->result.u.var].tmp_var);
-                                               ((zend_internal_function *) function_state.function)->handler(opline->extended_value, &Ts[opline->result.u.var].tmp_var, &EG(regular_list), &EG(persistent_list), object.ptr, (opline->result.u.EA.type ^ EXT_TYPE_UNUSED));
+                                               ((zend_internal_function *) function_state.function)->handler(opline->extended_value, &Ts[opline->result.u.var].tmp_var, &EG(regular_list), &EG(persistent_list), object.ptr, !return_value_not_used);
                                                if (object.ptr) {
                                                        object.ptr->refcount--;
                                                }
-                                               if (opline->result.u.EA.type & EXT_TYPE_UNUSED) {
-                                                       zendi_zval_dtor(Ts[opline->result.u.var].tmp_var);
-                                               }
                                        } else if (function_state.function->type==ZEND_USER_FUNCTION) {
                                                HashTable *calling_symbol_table;
 
@@ -1520,6 +1518,9 @@ do_fcall_common:
                                                call_overloaded_function(opline->extended_value, &Ts[opline->result.u.var].tmp_var, &EG(regular_list), &EG(persistent_list) ELS_CC);
                                                efree(fbc);
                                        }
+                                       if (return_value_not_used) {
+                                                       zendi_zval_dtor(Ts[opline->result.u.var].tmp_var);
+                                       }
                                        object.ptr = zend_ptr_stack_pop(&EG(arg_types_stack));
                                        if (opline->opcode == ZEND_DO_FCALL_BY_NAME) {
                                                fbc = zend_ptr_stack_pop(&EG(arg_types_stack));