summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2014-04-22 17:46:34 +0400
committerDmitry Stogov <dmitry@zend.com>2014-04-22 17:46:34 +0400
commit5864ce8a447b718d0912cb073afe87eddc47b2e8 (patch)
tree81d7b40143c084383637c253bd61c3c795ca428f /Zend
parentc0b49a701a74f9be1f99f79c4334d4aecdf1f1c6 (diff)
downloadphp-git-5864ce8a447b718d0912cb073afe87eddc47b2e8.tar.gz
Fixed compilation warnings
Diffstat (limited to 'Zend')
-rw-r--r--Zend/zend.c4
-rw-r--r--Zend/zend_API.c10
-rw-r--r--Zend/zend_builtin_functions.c23
-rw-r--r--Zend/zend_constants.c18
-rw-r--r--Zend/zend_execute.c6
-rw-r--r--Zend/zend_hash.h19
-rw-r--r--Zend/zend_list.c2
-rw-r--r--Zend/zend_objects_API.c4
-rw-r--r--Zend/zend_operators.c4
-rw-r--r--Zend/zend_vm_def.h5
-rw-r--r--Zend/zend_vm_execute.h27
11 files changed, 59 insertions, 63 deletions
diff --git a/Zend/zend.c b/Zend/zend.c
index a722531283..dc0ae2739b 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -133,7 +133,6 @@ static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent,
{
zval *tmp;
zend_string *string_key;
- HashPosition iterator;
ulong num_key;
int i;
@@ -193,7 +192,6 @@ static void print_flat_hash(HashTable *ht TSRMLS_DC) /* {{{ */
{
zval *tmp;
zend_string *string_key;
- HashPosition iterator;
ulong num_key;
int i = 0;
@@ -1029,7 +1027,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
zval params[5];
zval retval;
const char *error_filename;
- uint error_lineno;
+ uint error_lineno = 0;
zval orig_user_error_handler;
zend_bool in_compilation;
zend_class_entry *saved_class_entry;
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 6cf6cb2157..9212527963 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -1222,10 +1222,9 @@ ZEND_API void object_properties_init_ex(zend_object *object, HashTable *properti
if (object->ce->default_properties_count) {
zval *prop, tmp;
zend_string *key;
- ulong num_key;
zend_property_info *property_info;
- ZEND_HASH_FOREACH_KEY_VAL(properties, num_key, key, prop) {
+ ZEND_HASH_FOREACH_STR_KEY_VAL(properties, key, prop) {
ZVAL_STR(&tmp, key);
property_info = zend_get_property_info(object->ce, &tmp, 1 TSRMLS_CC);
if (property_info &&
@@ -1243,10 +1242,9 @@ ZEND_API void object_properties_load(zend_object *object, HashTable *properties
{
zval *prop, tmp;
zend_string *key;
- ulong num_key;
zend_property_info *property_info;
- ZEND_HASH_FOREACH_KEY_VAL(properties, num_key, key, prop) {
+ ZEND_HASH_FOREACH_STR_KEY_VAL(properties, key, prop) {
ZVAL_STR(&tmp, key);
property_info = zend_get_property_info(object->ce, &tmp, 1 TSRMLS_CC);
if (property_info &&
@@ -4000,10 +3998,8 @@ ZEND_API zend_string* zend_find_alias_name(zend_class_entry *ce, zend_string *na
ZEND_API zend_string *zend_resolve_method_name(zend_class_entry *ce, zend_function *f) /* {{{ */
{
zend_function *func;
- HashPosition iterator;
HashTable *function_table;
zend_string *name;
- ulong idx;
if (f->common.type != ZEND_USER_FUNCTION ||
*(f->op_array.refcount) < 2 ||
@@ -4013,7 +4009,7 @@ ZEND_API zend_string *zend_resolve_method_name(zend_class_entry *ce, zend_functi
}
function_table = &ce->function_table;
- ZEND_HASH_FOREACH_KEY_PTR(function_table, idx, name, func) {
+ ZEND_HASH_FOREACH_STR_KEY_PTR(function_table, name, func) {
if (func == f) {
if (!name) {
return f->common.function_name;
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index 4664532b8f..22076104f0 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -619,13 +619,10 @@ ZEND_FUNCTION(each)
zend_hash_str_update(Z_ARRVAL_P(return_value), "value", sizeof("value")-1, entry);
/* add the key elements */
- switch (zend_hash_get_current_key(target_hash, &key, &num_key, 0)) {
- case HASH_KEY_IS_STRING:
- inserted_pointer = add_get_index_str(return_value, 0, STR_COPY(key));
- break;
- case HASH_KEY_IS_LONG:
- inserted_pointer = add_get_index_long(return_value, 0, num_key);
- break;
+ if (zend_hash_get_current_key(target_hash, &key, &num_key, 0) == HASH_KEY_IS_STRING) {
+ inserted_pointer = add_get_index_str(return_value, 0, STR_COPY(key));
+ } else {
+ inserted_pointer = add_get_index_long(return_value, 0, num_key);
}
zend_hash_str_update(Z_ARRVAL_P(return_value), "key", sizeof("key")-1, inserted_pointer);
if (Z_REFCOUNTED_P(inserted_pointer)) Z_ADDREF_P(inserted_pointer);
@@ -902,9 +899,8 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
zend_property_info *prop_info;
zval *prop, prop_copy;
zend_string *key;
- ulong num_index;
- ZEND_HASH_FOREACH_KEY_PTR(&ce->properties_info, num_index, key, prop_info) {
+ ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->properties_info, key, prop_info) {
if (((prop_info->flags & ZEND_ACC_SHADOW) &&
prop_info->ce != EG(scope)) ||
((prop_info->flags & ZEND_ACC_PROTECTED) &&
@@ -975,7 +971,6 @@ ZEND_FUNCTION(get_object_vars)
zend_string *key;
const char *prop_name, *class_name;
uint prop_len;
- ulong num_index;
zend_object *zobj;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &obj) == FAILURE) {
@@ -996,7 +991,7 @@ ZEND_FUNCTION(get_object_vars)
array_init(return_value);
- ZEND_HASH_FOREACH_KEY_VAL_IND(properties, num_index, key, value) {
+ ZEND_HASH_FOREACH_STR_KEY_VAL_IND(properties, key, value) {
if (key) {
if (zend_check_property_access(zobj, key TSRMLS_CC) == SUCCESS) {
/* Not separating references */
@@ -1030,7 +1025,6 @@ ZEND_FUNCTION(get_class_methods)
zend_class_entry *ce = NULL;
zend_function *mptr;
zend_string *key;
- ulong num_index;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &klass) == FAILURE) {
return;
@@ -1052,7 +1046,7 @@ ZEND_FUNCTION(get_class_methods)
array_init(return_value);
- ZEND_HASH_FOREACH_KEY_PTR(&ce->function_table, num_index, key, mptr) {
+ ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->function_table, key, mptr) {
if ((mptr->common.fn_flags & ZEND_ACC_PUBLIC)
|| (EG(scope) &&
@@ -1422,14 +1416,13 @@ ZEND_FUNCTION(crash)
ZEND_FUNCTION(get_included_files)
{
zend_string *entry;
- ulong num_idx;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
array_init(return_value);
- ZEND_HASH_FOREACH_KEY(&EG(included_files), num_idx, entry) {
+ ZEND_HASH_FOREACH_STR_KEY(&EG(included_files), entry) {
if (entry) {
add_next_index_str(return_value, STR_COPY(entry));
}
diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c
index 30ae65d267..72fa9cb177 100644
--- a/Zend/zend_constants.c
+++ b/Zend/zend_constants.c
@@ -309,7 +309,6 @@ ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result,
const char *colon;
zend_class_entry *ce = NULL;
zend_string *class_name;
- zval *ret_constant;
/* Skip leading \\ */
if (name[0] == '\\') {
@@ -317,13 +316,13 @@ ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result,
name_len -= 1;
}
-
if ((colon = zend_memrchr(name, ':', name_len)) &&
colon > name && (*(colon - 1) == ':')) {
int class_name_len = colon - name - 1;
int const_name_len = name_len - class_name_len - 2;
zend_string *constant_name = STR_INIT(colon + 1, const_name_len, 0);
zend_string *lcname;
+ zval *ret_constant = NULL;
class_name = STR_INIT(name, class_name_len, 0);
lcname = STR_ALLOC(class_name_len, 0);
@@ -381,7 +380,11 @@ ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result,
}
STR_FREE(class_name);
STR_FREE(constant_name);
- goto finish;
+ if (retval) {
+ zval_update_constant_ex(ret_constant, (void*)1, ce TSRMLS_CC);
+ ZVAL_DUP(result, ret_constant);
+ }
+ return retval;
}
/* non-class constant */
@@ -425,14 +428,7 @@ ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result,
name_len = const_name_len;
return zend_get_constant(name, name_len, result TSRMLS_CC);
}
- retval = 0;
-finish:
- if (retval) {
- zval_update_constant_ex(ret_constant, (void*)1, ce TSRMLS_CC);
- ZVAL_DUP(result, ret_constant);
- }
-
- return retval;
+ return 0;
}
return zend_get_constant(name, name_len, result TSRMLS_CC);
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 839fc491ef..2866f841d6 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -382,10 +382,10 @@ static inline zval *_get_zval_ptr(int op_type, const znode_op *node, const zend_
return NULL;
break;
case IS_CV:
+ default:
should_free->var = NULL;
return _get_zval_ptr_cv(execute_data, node->var, type TSRMLS_CC);
break;
- EMPTY_SWITCH_DEFAULT_CASE()
}
return NULL;
}
@@ -412,10 +412,10 @@ static inline zval *_get_zval_ptr_deref(int op_type, const znode_op *node, const
return NULL;
break;
case IS_CV:
+ default:
should_free->var = NULL;
return _get_zval_ptr_cv_deref(execute_data, node->var, type TSRMLS_CC);
break;
- EMPTY_SWITCH_DEFAULT_CASE()
}
return NULL;
}
@@ -438,8 +438,6 @@ static zend_always_inline zval *_get_zval_ptr_ptr_var(zend_uint var, const zend_
static inline zval *_get_zval_ptr_ptr(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
{
- zval *ret;
-
if (op_type == IS_CV) {
should_free->var = NULL;
return _get_zval_ptr_cv(execute_data, node->var, type TSRMLS_CC);
diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h
index cc1dcca0e7..829348d388 100644
--- a/Zend/zend_hash.h
+++ b/Zend/zend_hash.h
@@ -569,23 +569,42 @@ static inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht, HashPositio
ZEND_HASH_FOREACH(ht, 0); \
_ptr = Z_PTR_P(_z);
+#define ZEND_HASH_FOREACH_STR_KEY(ht, _key) \
+ ZEND_HASH_FOREACH(ht, 0); \
+ _key = _p->key;
+
#define ZEND_HASH_FOREACH_KEY(ht, _h, _key) \
ZEND_HASH_FOREACH(ht, 0); \
_h = _p->h; \
_key = _p->key;
+#define ZEND_HASH_FOREACH_STR_KEY_VAL(ht, _key, _val) \
+ ZEND_HASH_FOREACH(ht, 0); \
+ _key = _p->key; \
+ _val = _z;
+
#define ZEND_HASH_FOREACH_KEY_VAL(ht, _h, _key, _val) \
ZEND_HASH_FOREACH(ht, 0); \
_h = _p->h; \
_key = _p->key; \
_val = _z;
+#define ZEND_HASH_FOREACH_STR_KEY_VAL_IND(ht, _key, _val) \
+ ZEND_HASH_FOREACH(ht, 1); \
+ _key = _p->key; \
+ _val = _z;
+
#define ZEND_HASH_FOREACH_KEY_VAL_IND(ht, _h, _key, _val) \
ZEND_HASH_FOREACH(ht, 1); \
_h = _p->h; \
_key = _p->key; \
_val = _z;
+#define ZEND_HASH_FOREACH_STR_KEY_PTR(ht, _key, _ptr) \
+ ZEND_HASH_FOREACH(ht, 0); \
+ _key = _p->key; \
+ _ptr = Z_PTR_P(_z);
+
#define ZEND_HASH_FOREACH_KEY_PTR(ht, _h, _key, _ptr) \
ZEND_HASH_FOREACH(ht, 0); \
_h = _p->h; \
diff --git a/Zend/zend_list.c b/Zend/zend_list.c
index fa1af76397..c9b9ff66df 100644
--- a/Zend/zend_list.c
+++ b/Zend/zend_list.c
@@ -329,8 +329,6 @@ static void list_destructors_dtor(zval *zv)
int zend_init_rsrc_list_dtors(void)
{
- int retval;
-
zend_hash_init(&list_destructors, 64, NULL, list_destructors_dtor, 1);
list_destructors.nNextFreeElement=1; /* we don't want resource type 0 */
return SUCCESS;
diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c
index 285a752c2b..bd6673c0bb 100644
--- a/Zend/zend_objects_API.c
+++ b/Zend/zend_objects_API.c
@@ -276,12 +276,12 @@ ZEND_API void zend_object_proxy_set(zval *property, zval *value TSRMLS_DC)
}
}
-ZEND_API zval* zend_object_proxy_get(zval *property TSRMLS_DC)
+ZEND_API zval* zend_object_proxy_get(zval *property, zval *rv TSRMLS_DC)
{
zend_proxy_object *probj = (zend_proxy_object*)Z_OBJ_P(property);
if (Z_OBJ_HT(probj->object) && Z_OBJ_HT(probj->object)->read_property) {
- return Z_OBJ_HT(probj->object)->read_property(&probj->object, &probj->property, BP_VAR_R, -1, NULL TSRMLS_CC);
+ return Z_OBJ_HT(probj->object)->read_property(&probj->object, &probj->property, BP_VAR_R, -1, rv TSRMLS_CC);
} else {
zend_error(E_WARNING, "Cannot read property of object - no read handler defined");
}
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index d943ae739a..397f8f60d7 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -1807,7 +1807,7 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {
}
/* }}} */
-static int hash_zval_identical_function(const zval *z1, const zval *z2) /* {{{ */
+static int hash_zval_identical_function(zval *z1, zval *z2) /* {{{ */
{
zval result;
TSRMLS_FETCH();
@@ -2406,7 +2406,7 @@ string_cmp:
}
/* }}} */
-static int hash_zval_compare_function(const zval *z1, const zval *z2 TSRMLS_DC) /* {{{ */
+static int hash_zval_compare_function(zval *z1, zval *z2 TSRMLS_DC) /* {{{ */
{
zval result;
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 11fafb53ab..7b65cd6f4a 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -1540,7 +1540,7 @@ ZEND_VM_HANDLER(97, ZEND_FETCH_OBJ_UNSET, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *container, *property, *retval_ptr;
+ zval *container, *property;
SAVE_OPLINE();
container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_UNSET);
@@ -3128,11 +3128,10 @@ ZEND_VM_C_LABEL(send_again):
HashTable *ht = Z_ARRVAL_P(args);
zval *arg;
zend_string *name;
- zend_ulong index;
ZEND_VM_STACK_GROW_IF_NEEDED(zend_hash_num_elements(ht));
- ZEND_HASH_FOREACH_KEY_VAL(ht, index, name, arg) {
+ ZEND_HASH_FOREACH_STR_KEY_VAL(ht, name, arg) {
if (name) {
zend_error(E_RECOVERABLE_ERROR, "Cannot unpack array with string keys");
FREE_OP1();
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 6ee7eed781..512267f9e1 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -724,11 +724,10 @@ send_again:
HashTable *ht = Z_ARRVAL_P(args);
zval *arg;
zend_string *name;
- zend_ulong index;
ZEND_VM_STACK_GROW_IF_NEEDED(zend_hash_num_elements(ht));
- ZEND_HASH_FOREACH_KEY_VAL(ht, index, name, arg) {
+ ZEND_HASH_FOREACH_STR_KEY_VAL(ht, name, arg) {
if (name) {
zend_error(E_RECOVERABLE_ERROR, "Cannot unpack array with string keys");
FREE_OP(free_op1);
@@ -14584,7 +14583,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CONST_HANDLER(ZEND_OPCOD
{
USE_OPLINE
zend_free_op free_op1;
- zval *container, *property, *retval_ptr;
+ zval *container, *property;
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
@@ -16747,7 +16746,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *container, *property, *retval_ptr;
+ zval *container, *property;
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
@@ -18814,7 +18813,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *container, *property, *retval_ptr;
+ zval *container, *property;
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
@@ -22090,7 +22089,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_H
{
USE_OPLINE
zend_free_op free_op1;
- zval *container, *property, *retval_ptr;
+ zval *container, *property;
SAVE_OPLINE();
container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
@@ -23732,7 +23731,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CONST_HANDLER(ZEND_OP
{
USE_OPLINE
zend_free_op free_op1;
- zval *container, *property, *retval_ptr;
+ zval *container, *property;
SAVE_OPLINE();
container = _get_obj_zval_ptr_unused(TSRMLS_C);
@@ -25060,7 +25059,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCO
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *container, *property, *retval_ptr;
+ zval *container, *property;
SAVE_OPLINE();
container = _get_obj_zval_ptr_unused(TSRMLS_C);
@@ -26301,7 +26300,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCO
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *container, *property, *retval_ptr;
+ zval *container, *property;
SAVE_OPLINE();
container = _get_obj_zval_ptr_unused(TSRMLS_C);
@@ -28031,7 +28030,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CV_HANDLER(ZEND_OPCOD
{
USE_OPLINE
zend_free_op free_op1;
- zval *container, *property, *retval_ptr;
+ zval *container, *property;
SAVE_OPLINE();
container = _get_obj_zval_ptr_unused(TSRMLS_C);
@@ -31069,7 +31068,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_CONST_HANDLER(ZEND_OPCODE
{
USE_OPLINE
zend_free_op free_op1;
- zval *container, *property, *retval_ptr;
+ zval *container, *property;
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
@@ -33019,7 +33018,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_H
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *container, *property, *retval_ptr;
+ zval *container, *property;
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
@@ -34969,7 +34968,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_H
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *container, *property, *retval_ptr;
+ zval *container, *property;
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
@@ -37993,7 +37992,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HA
{
USE_OPLINE
zend_free_op free_op1;
- zval *container, *property, *retval_ptr;
+ zval *container, *property;
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);