summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
Diffstat (limited to 'Zend')
-rw-r--r--Zend/zend.c4
-rw-r--r--Zend/zend.h52
-rw-r--r--Zend/zend_API.c39
-rw-r--r--Zend/zend_API.h126
-rw-r--r--Zend/zend_alloc.h3
-rw-r--r--Zend/zend_builtin_functions.c21
-rw-r--r--Zend/zend_closures.c4
-rw-r--r--Zend/zend_compile.c47
-rw-r--r--Zend/zend_compile.h8
-rw-r--r--Zend/zend_constants.c2
-rw-r--r--Zend/zend_exceptions.c6
-rw-r--r--Zend/zend_execute.c8
-rw-r--r--Zend/zend_execute.h26
-rw-r--r--Zend/zend_execute_API.c22
-rw-r--r--Zend/zend_hash.c4
-rw-r--r--Zend/zend_ini.h6
-rw-r--r--Zend/zend_iterators.c2
-rw-r--r--Zend/zend_objects_API.c26
-rw-r--r--Zend/zend_opcode.c2
-rw-r--r--Zend/zend_operators.c26
-rw-r--r--Zend/zend_string.c19
-rw-r--r--Zend/zend_types.h12
-rw-r--r--Zend/zend_variables.c11
-rw-r--r--Zend/zend_variables.h1
24 files changed, 84 insertions, 393 deletions
diff --git a/Zend/zend.c b/Zend/zend.c
index b7946ca61e..57344547d5 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -242,7 +242,7 @@ again:
}
case IS_BOOL:
if (Z_LVAL_P(expr)) {
- // TODO: ??? use interned string
+ // TODO: use interned string ???
ZVAL_NEW_STR(expr_copy, STR_INIT("1", 1, 0));
} else {
TSRMLS_FETCH();
@@ -259,7 +259,7 @@ again:
break;
case IS_ARRAY:
zend_error(E_NOTICE, "Array to string conversion");
- // TODO: ??? use interned string
+ // TODO: use interned string ???
ZVAL_NEW_STR(expr_copy, STR_INIT("Array", sizeof("Array") - 1, 0));
break;
case IS_OBJECT:
diff --git a/Zend/zend.h b/Zend/zend.h
index 6580aa0f6b..c81c223a7f 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -583,11 +583,6 @@ ZEND_API void free_estring(char **str_p);
ZEND_API void free_string_zval(zval *zv);
END_EXTERN_C()
-/* FIXME: Check if we can save if (ptr) too */
-
-//???#define STR_FREE(ptr) if (ptr) { str_efree(ptr); }
-//???#define STR_FREE_REL(ptr) if (ptr) { str_efree_rel(ptr); }
-
/* output support */
#define ZEND_WRITE(str, str_len) zend_write((str), (str_len))
#define ZEND_WRITE_EX(str, str_len) write_func((str), (str_len))
@@ -680,18 +675,6 @@ END_EXTERN_C()
} \
} while (0)
-//??? this macro should be used to get argument value passed by referebce
-//??? unfortunately it's not always work as expected
-#if 0
-#define ZVAL_DEREF_REF(z) do { \
- ZEND_ASSERT(Z_ISREF_P(z)); \
- (z) = Z_REFVAL_P(z); \
- } while (0)
-#else
-#define ZVAL_DEREF_REF(z) \
- ZVAL_DEREF(z)
-#endif
-
#define ZVAL_DUP_DEREF(z, v) \
do { \
zval *__z1 = (z); \
@@ -710,14 +693,6 @@ END_EXTERN_C()
efree(ref); \
} while (0)
-// TODO: invalud ???
-#define INIT_PZVAL_COPY(z, v) \
- do { \
- ZVAL_COPY_VALUE(z, v); \
- Z_SET_REFCOUNT_P(z, 1); \
- Z_UNSET_ISREF_P(z); \
- } while (0)
-
#define SEPARATE_ZVAL(zv) do { \
zval *_zv = (zv); \
if (Z_REFCOUNTED_P(_zv)) { \
@@ -769,33 +744,6 @@ END_EXTERN_C()
} \
} while (0)
-
-// TODO: remove ???
-#define COPY_PZVAL_TO_ZVAL(zv, pzv) \
- ZVAL_COPY_VALUE(&(zv), (pzv)); \
- if (Z_OPT_REFCOUNTED_P(pzv)) { \
- if (Z_REFCOUNT_P(pzv)>1) { \
- zval_copy_ctor(&(zv)); \
- Z_DELREF_P((pzv)); \
- } \
- } \
-
-// TODO: remove ???
-#define REPLACE_ZVAL_VALUE(ppzv_dest, pzv_src, copy) { \
- int is_ref, refcount; \
- \
- SEPARATE_ZVAL_IF_NOT_REF(ppzv_dest); \
- is_ref = Z_ISREF_PP(ppzv_dest); \
- refcount = Z_REFCOUNT_PP(ppzv_dest); \
- zval_dtor(*ppzv_dest); \
- ZVAL_COPY_VALUE(*ppzv_dest, pzv_src); \
- if (copy) { \
- zval_opt_copy_ctor(*ppzv_dest); \
- } \
- Z_SET_ISREF_TO_PP(ppzv_dest, is_ref); \
- Z_SET_REFCOUNT_PP(ppzv_dest, refcount); \
-}
-
#define SEPARATE_ARG_IF_REF(varptr) do { \
zval *_varptr = (varptr); \
if (Z_ISREF_P(_varptr)) { \
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index a748ec38d4..ab22aba77e 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -1207,7 +1207,6 @@ ZEND_API void object_properties_init(zend_object *object, zend_class_entry *clas
int i;
if (class_type->default_properties_count) {
-//??? object->properties_table = emalloc(sizeof(zval*) * class_type->default_properties_count);
for (i = 0; i < class_type->default_properties_count; i++) {
#if ZTS
ZVAL_DUP(&object->properties_table[i], &class_type->default_properties_table[i]);
@@ -1392,22 +1391,20 @@ ZEND_API int add_assoc_str_ex(zval *arg, const char *key, uint key_len, zend_str
}
/* }}} */
-ZEND_API int add_assoc_string_ex(zval *arg, const char *key, uint key_len, char *str, int duplicate) /* {{{ */
+ZEND_API int add_assoc_string_ex(zval *arg, const char *key, uint key_len, char *str) /* {{{ */
{
zval *ret, tmp;
-//??? ZVAL_STRING(tmp, str, duplicate);
ZVAL_STRING(&tmp, str);
ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp);
return ret ? SUCCESS : FAILURE;
}
/* }}} */
-ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, char *str, uint length, int duplicate) /* {{{ */
+ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, char *str, uint length) /* {{{ */
{
zval *ret, tmp;
-//??? ZVAL_STRINGL(tmp, str, length, duplicate);
ZVAL_STRINGL(&tmp, str, length);
ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp);
return ret ? SUCCESS : FAILURE;
@@ -1477,23 +1474,20 @@ ZEND_API int add_index_str(zval *arg, ulong index, zend_string *str) /* {{{ */
}
/* }}} */
-ZEND_API int add_index_string(zval *arg, ulong index, const char *str, int duplicate) /* {{{ */
+ZEND_API int add_index_string(zval *arg, ulong index, const char *str) /* {{{ */
{
zval tmp;
-//??? ZVAL_STRING(tmp, str, duplicate);
ZVAL_STRING(&tmp, str);
return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp) ? SUCCESS : FAILURE;
}
/* }}} */
-ZEND_API int add_index_stringl(zval *arg, ulong index, const char *str, uint length, int duplicate) /* {{{ */
+ZEND_API int add_index_stringl(zval *arg, ulong index, const char *str, uint length) /* {{{ */
{
zval tmp;
-//??? ZVAL_STRINGL(tmp, str, length, duplicate);
ZVAL_STRINGL(&tmp, str, length);
-
return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp) ? SUCCESS : FAILURE;
}
/* }}} */
@@ -1558,21 +1552,19 @@ ZEND_API int add_next_index_str(zval *arg, zend_string *str) /* {{{ */
}
/* }}} */
-ZEND_API int add_next_index_string(zval *arg, const char *str, int duplicate) /* {{{ */
+ZEND_API int add_next_index_string(zval *arg, const char *str) /* {{{ */
{
zval tmp;
-//??? ZVAL_STRING(&tmp, str, duplicate);
ZVAL_STRING(&tmp, str);
return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp) ? SUCCESS : FAILURE;
}
/* }}} */
-ZEND_API int add_next_index_stringl(zval *arg, const char *str, uint length, int duplicate) /* {{{ */
+ZEND_API int add_next_index_stringl(zval *arg, const char *str, uint length) /* {{{ */
{
zval tmp;
-//??? ZVAL_STRINGL(&tmp, str, length, duplicate);
ZVAL_STRINGL(&tmp, str, length);
return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp) ? SUCCESS : FAILURE;
}
@@ -1584,22 +1576,20 @@ ZEND_API int add_next_index_zval(zval *arg, zval *value) /* {{{ */
}
/* }}} */
-ZEND_API zval *add_get_assoc_string_ex(zval *arg, const char *key, uint key_len, const char *str, int duplicate) /* {{{ */
+ZEND_API zval *add_get_assoc_string_ex(zval *arg, const char *key, uint key_len, const char *str) /* {{{ */
{
zval tmp, *ret;
-//??? ZVAL_STRING(tmp, str, duplicate);
ZVAL_STRING(&tmp, str);
ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp);
return ret;
}
/* }}} */
-ZEND_API zval *add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, int duplicate) /* {{{ */
+ZEND_API zval *add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length) /* {{{ */
{
zval tmp, *ret;
-//??? ZVAL_STRING(tmp, str, length, duplicate);
ZVAL_STRINGL(&tmp, str, length);
ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp);
return ret;
@@ -1628,27 +1618,24 @@ ZEND_API zval *add_get_index_str(zval *arg, ulong index, zend_string *str) /* {{
{
zval tmp;
-//??? ZVAL_STRING(tmp, str, duplicate);
ZVAL_STR(&tmp, str);
return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp);
}
/* }}} */
-ZEND_API zval *add_get_index_string(zval *arg, ulong index, const char *str, int duplicate) /* {{{ */
+ZEND_API zval *add_get_index_string(zval *arg, ulong index, const char *str) /* {{{ */
{
zval tmp;
-//??? ZVAL_STRING(tmp, str, duplicate);
ZVAL_STRING(&tmp, str);
return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp);
}
/* }}} */
-ZEND_API zval *add_get_index_stringl(zval *arg, ulong index, const char *str, uint length, int duplicate) /* {{{ */
+ZEND_API zval *add_get_index_stringl(zval *arg, ulong index, const char *str, uint length) /* {{{ */
{
zval tmp;
-//??? ZVAL_STRINGL(tmp, str, length, duplicate);
ZVAL_STRINGL(&tmp, str, length);
return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp);
}
@@ -1762,12 +1749,11 @@ ZEND_API int add_property_double_ex(zval *arg, const char *key, uint key_len, do
}
/* }}} */
-ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, const char *str, int duplicate TSRMLS_DC) /* {{{ */
+ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, const char *str TSRMLS_DC) /* {{{ */
{
zval tmp;
zval z_key;
-//??? ZVAL_STRING(tmp, str, duplicate);
ZVAL_STRING(&tmp, str);
ZVAL_STRINGL(&z_key, key, key_len);
Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, 0 TSRMLS_CC);
@@ -1777,12 +1763,11 @@ ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, co
}
/* }}} */
-ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, int duplicate TSRMLS_DC) /* {{{ */
+ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length TSRMLS_DC) /* {{{ */
{
zval tmp;
zval z_key;
-//??? ZVAL_STRINGL(tmp, str, length, duplicate);
ZVAL_STRINGL(&tmp, str, length);
ZVAL_STRINGL(&z_key, key, key_len);
Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, 0 TSRMLS_CC);
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index b1c36b268a..6295d8a890 100644
--- a/Zend/zend_API.h
+++ b/Zend/zend_API.h
@@ -380,8 +380,8 @@ ZEND_API int add_assoc_bool_ex(zval *arg, const char *key, uint key_len, int b);
ZEND_API int add_assoc_resource_ex(zval *arg, const char *key, uint key_len, zend_resource *r);
ZEND_API int add_assoc_double_ex(zval *arg, const char *key, uint key_len, double d);
ZEND_API int add_assoc_str_ex(zval *arg, const char *key, uint key_len, zend_string *str);
-ZEND_API int add_assoc_string_ex(zval *arg, const char *key, uint key_len, char *str, int duplicate);
-ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, char *str, uint length, int duplicate);
+ZEND_API int add_assoc_string_ex(zval *arg, const char *key, uint key_len, char *str);
+ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, char *str, uint length);
ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *value);
#define add_assoc_long(__arg, __key, __n) add_assoc_long_ex(__arg, __key, strlen(__key), __n)
@@ -390,8 +390,8 @@ ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *v
#define add_assoc_resource(__arg, __key, __r) add_assoc_resource_ex(__arg, __key, strlen(__key), __r)
#define add_assoc_double(__arg, __key, __d) add_assoc_double_ex(__arg, __key, strlen(__key), __d)
#define add_assoc_str(__arg, __key, __str) add_assoc_str_ex(__arg, __key, strlen(__key), __str)
-#define add_assoc_string(__arg, __key, __str, __duplicate) add_assoc_string_ex(__arg, __key, strlen(__key), __str, __duplicate)
-#define add_assoc_stringl(__arg, __key, __str, __length, __duplicate) add_assoc_stringl_ex(__arg, __key, strlen(__key), __str, __length, __duplicate)
+#define add_assoc_string(__arg, __key, __str) add_assoc_string_ex(__arg, __key, strlen(__key), __str)
+#define add_assoc_stringl(__arg, __key, __str, __length) add_assoc_stringl_ex(__arg, __key, strlen(__key), __str, __length)
#define add_assoc_zval(__arg, __key, __value) add_assoc_zval_ex(__arg, __key, strlen(__key), __value)
/* unset() functions are only suported for legacy modules and null() functions should be used */
@@ -406,8 +406,8 @@ ZEND_API int add_index_bool(zval *arg, ulong idx, int b);
ZEND_API int add_index_resource(zval *arg, ulong idx, zend_resource *r);
ZEND_API int add_index_double(zval *arg, ulong idx, double d);
ZEND_API int add_index_str(zval *arg, ulong idx, zend_string *str);
-ZEND_API int add_index_string(zval *arg, ulong idx, const char *str, int duplicate);
-ZEND_API int add_index_stringl(zval *arg, ulong idx, const char *str, uint length, int duplicate);
+ZEND_API int add_index_string(zval *arg, ulong idx, const char *str);
+ZEND_API int add_index_stringl(zval *arg, ulong idx, const char *str, uint length);
ZEND_API int add_index_zval(zval *arg, ulong index, zval *value);
ZEND_API int add_next_index_long(zval *arg, long n);
@@ -416,21 +416,21 @@ ZEND_API int add_next_index_bool(zval *arg, int b);
ZEND_API int add_next_index_resource(zval *arg, zend_resource *r);
ZEND_API int add_next_index_double(zval *arg, double d);
ZEND_API int add_next_index_str(zval *arg, zend_string *str);
-ZEND_API int add_next_index_string(zval *arg, const char *str, int duplicate);
-ZEND_API int add_next_index_stringl(zval *arg, const char *str, uint length, int duplicate);
+ZEND_API int add_next_index_string(zval *arg, const char *str);
+ZEND_API int add_next_index_stringl(zval *arg, const char *str, uint length);
ZEND_API int add_next_index_zval(zval *arg, zval *value);
-ZEND_API zval *add_get_assoc_string_ex(zval *arg, const char *key, uint key_len, const char *str, int duplicate);
-ZEND_API zval *add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, int duplicate);
+ZEND_API zval *add_get_assoc_string_ex(zval *arg, const char *key, uint key_len, const char *str);
+ZEND_API zval *add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length);
-#define add_get_assoc_string(__arg, __key, __str, __duplicate) add_get_assoc_string_ex(__arg, __key, strlen(__key), __str, __duplicate)
-#define add_get_assoc_stringl(__arg, __key, __str, __length, __duplicate) add_get_assoc_stringl_ex(__arg, __key, strlen(__key), __str, __length, __duplicate)
+#define add_get_assoc_string(__arg, __key, __str) add_get_assoc_string_ex(__arg, __key, strlen(__key), __str)
+#define add_get_assoc_stringl(__arg, __key, __str, __length) add_get_assoc_stringl_ex(__arg, __key, strlen(__key), __str, __length)
ZEND_API zval *add_get_index_long(zval *arg, ulong idx, long l);
ZEND_API zval *add_get_index_double(zval *arg, ulong idx, double d);
ZEND_API zval *add_get_index_str(zval *arg, ulong index, zend_string *str);
-ZEND_API zval *add_get_index_string(zval *arg, ulong idx, const char *str, int duplicate);
-ZEND_API zval *add_get_index_stringl(zval *arg, ulong idx, const char *str, uint length, int duplicate);
+ZEND_API zval *add_get_index_string(zval *arg, ulong idx, const char *str);
+ZEND_API zval *add_get_index_stringl(zval *arg, ulong idx, const char *str, uint length);
ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value TSRMLS_DC);
@@ -439,8 +439,8 @@ ZEND_API int add_property_null_ex(zval *arg, const char *key, uint key_len TSRML
ZEND_API int add_property_bool_ex(zval *arg, const char *key, uint key_len, int b TSRMLS_DC);
ZEND_API int add_property_resource_ex(zval *arg, const char *key, uint key_len, zend_resource *r TSRMLS_DC);
ZEND_API int add_property_double_ex(zval *arg, const char *key, uint key_len, double d TSRMLS_DC);
-ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, const char *str, int duplicate TSRMLS_DC);
-ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, int duplicate TSRMLS_DC);
+ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, const char *str TSRMLS_DC);
+ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length TSRMLS_DC);
ZEND_API int add_property_zval_ex(zval *arg, const char *key, uint key_len, zval *value TSRMLS_DC);
#define add_property_long(__arg, __key, __n) add_property_long_ex(__arg, __key, strlen(__key), __n TSRMLS_CC)
@@ -448,8 +448,8 @@ ZEND_API int add_property_zval_ex(zval *arg, const char *key, uint key_len, zval
#define add_property_bool(__arg, __key, __b) add_property_bool_ex(__arg, __key, strlen(__key), __b TSRMLS_CC)
#define add_property_resource(__arg, __key, __r) add_property_resource_ex(__arg, __key, strlen(__key), __r TSRMLS_CC)
#define add_property_double(__arg, __key, __d) add_property_double_ex(__arg, __key, strlen(__key), __d TSRMLS_CC)
-#define add_property_string(__arg, __key, __str, __duplicate) add_property_string_ex(__arg, __key, strlen(__key), __str, __duplicate TSRMLS_CC)
-#define add_property_stringl(__arg, __key, __str, __length, __duplicate) add_property_stringl_ex(__arg, __key, strlen(__key), __str, __length, __duplicate TSRMLS_CC)
+#define add_property_string(__arg, __key, __str) add_property_string_ex(__arg, __key, strlen(__key), __str TSRMLS_CC)
+#define add_property_stringl(__arg, __key, __str, __length) add_property_stringl_ex(__arg, __key, strlen(__key), __str, __length TSRMLS_CC)
#define add_property_zval(__arg, __key, __value) add_property_zval_ex(__arg, __key, strlen(__key), __value TSRMLS_CC)
@@ -535,10 +535,10 @@ ZEND_API ZEND_FUNCTION(display_disabled_class);
END_EXTERN_C()
#if ZEND_DEBUG
-#define CHECK_ZVAL_STRING(z) \
- if (Z_STRVAL_P(z)[ Z_STRLEN_P(z) ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s)", Z_STRVAL_P(z)); }
-#define CHECK_ZVAL_STRING_REL(z) \
- if (Z_STRVAL_P(z)[ Z_STRLEN_P(z) ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s) (source: %s:%d)", Z_STRVAL_P(z) ZEND_FILE_LINE_RELAY_CC); }
+#define CHECK_ZVAL_STRING(str) \
+ if ((str)->val[(str)->len] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s)", (str)->val); }
+#define CHECK_ZVAL_STRING_REL(str) \
+ if ((str)->val[(str)->len] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s) (source: %s:%d)", (str)->val ZEND_FILE_LINE_RELAY_CC); }
#else
#define CHECK_ZVAL_STRING(z)
#define CHECK_ZVAL_STRING_REL(z)
@@ -638,88 +638,6 @@ END_EXTERN_C()
#define RETURN_ZVAL_FAST(z) { RETVAL_ZVAL_FAST(z); return; }
-#define SET_VAR_STRING(n, v) { \
- { \
- zval *var; \
- ALLOC_ZVAL(var); \
- ZVAL_STRING(var, v, 0); \
- ZEND_SET_GLOBAL_VAR(n, var); \
- } \
- }
-
-#define SET_VAR_STRINGL(n, v, l) { \
- { \
- zval *var; \
- ALLOC_ZVAL(var); \
- ZVAL_STRINGL(var, v, l, 0); \
- ZEND_SET_GLOBAL_VAR(n, var); \
- } \
- }
-
-#define SET_VAR_LONG(n, v) { \
- { \
- zval *var; \
- ALLOC_ZVAL(var); \
- ZVAL_LONG(var, v); \
- ZEND_SET_GLOBAL_VAR(n, var); \
- } \
- }
-
-#define SET_VAR_DOUBLE(n, v) { \
- { \
- zval *var; \
- ALLOC_ZVAL(var); \
- ZVAL_DOUBLE(var, v); \
- ZEND_SET_GLOBAL_VAR(n, var); \
- } \
- }
-
-
-#define ZEND_SET_SYMBOL(symtable, name, var) \
- { \
- char *_name = (name); \
- \
- ZEND_SET_SYMBOL_WITH_LENGTH(symtable, _name, strlen(_name), var, 1, 0); \
- }
-
-#define ZEND_SET_SYMBOL_WITH_LENGTH(symtable, name, name_length, var, _refcount, _is_ref) \
- { \
- zval *orig_var; \
- \
- if ((orig_var = zend_hash_str_find(symtable, (name), (name_length))) != NULL \
- && Z_ISREF_P(orig_var)) { \
- if (Z_REFCOUNTED_P(var)) { \
- Z_SET_REFCOUNT_P(var, Z_REFCOUNT_P(orig_var)); \
- if (_refcount) { \
- Z_SET_REFCOUNT_P(var, Z_REFCOUNT_P(var) + _refcount - 1); \
- } \
- } \
- zval_dtor(orig_var); \
- ZVAL_COPY_VALUE(orig_var, var); \
- /*???FREE_ZVAL(var);*/ \
- } else { \
- /*???Z_SET_ISREF_TO_P(var, _is_ref);*/ \
- if (_refcount && Z_REFCOUNTED_P(var)) { \
- Z_SET_REFCOUNT_P(var, _refcount); \
- } \
- zend_hash_str_update(symtable, (name), (name_length), var); \
- } \
- }
-
-
-#define ZEND_SET_GLOBAL_VAR(name, var) \
- ZEND_SET_SYMBOL(&EG(symbol_table).ht, name, var)
-
-#define ZEND_SET_GLOBAL_VAR_WITH_LENGTH(name, name_length, var, _refcount, _is_ref) \
- ZEND_SET_SYMBOL_WITH_LENGTH(&EG(symbol_table).ht, name, name_length, var, _refcount, _is_ref)
-
-#define ZEND_DEFINE_PROPERTY(class_ptr, name, value, mask) \
-{ \
- char *_name = (name); \
- int namelen = strlen(_name); \
- zend_declare_property(class_ptr, _name, namelen, value, mask TSRMLS_CC); \
-}
-
#define HASH_OF(p) (Z_TYPE_P(p)==IS_ARRAY ? Z_ARRVAL_P(p) : ((Z_TYPE_P(p)==IS_OBJECT ? Z_OBJ_HT_P(p)->get_properties((p) TSRMLS_CC) : NULL)))
#define ZVAL_IS_NULL(z) (Z_TYPE_P(z) == IS_NULL)
#define ZVAL_IS_UNDEF(z) (Z_TYPE_P(z) == IS_UNDEF)
diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h
index 0c004dcbe3..609db22dac 100644
--- a/Zend/zend_alloc.h
+++ b/Zend/zend_alloc.h
@@ -136,9 +136,6 @@ inline static void * __zend_realloc(void *p, size_t len)
#define perealloc_recoverable_rel(ptr, size, persistent) ((persistent)?__zend_realloc((ptr), (size)):erealloc_recoverable_rel((ptr), (size)))
#define pestrdup_rel(s, persistent) ((persistent)?strdup(s):estrdup_rel(s))
-//???#define safe_estrdup(ptr) ((ptr)?(estrdup(ptr)):STR_EMPTY_ALLOC())
-//???#define safe_estrndup(ptr, len) ((ptr)?(estrndup((ptr), (len))):STR_EMPTY_ALLOC())
-
ZEND_API int zend_set_memory_limit(size_t memory_limit TSRMLS_DC);
ZEND_API void start_memory_manager(TSRMLS_D);
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index f440f1d48f..6e101185bf 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -585,7 +585,7 @@ ZEND_FUNCTION(each)
return;
}
- ZVAL_DEREF_REF(array);
+ ZVAL_DEREF(array);
target_hash = HASH_OF(array);
if (!target_hash) {
zend_error(E_WARNING,"Variable passed to each() is not an array or object");
@@ -609,7 +609,6 @@ ZEND_FUNCTION(each)
/* add value elements */
if (Z_ISREF_P(entry)) {
ZVAL_DUP(&tmp, Z_REFVAL_P(entry));
-//??? if (Z_REFCOUNTED(tmp)) Z_SET_REFCOUNT(tmp, 0);
entry = &tmp;
}
zend_hash_index_update(Z_ARRVAL_P(return_value), 1, entry);
@@ -1863,14 +1862,14 @@ static int add_extension_info(zval *item, void *arg TSRMLS_DC)
{
zval *name_array = (zval *)arg;
zend_module_entry *module = (zend_module_entry*)Z_PTR_P(item);
- add_next_index_string(name_array, module->name, 1);
+ add_next_index_string(name_array, module->name);
return 0;
}
static int add_zendext_info(zend_extension *ext, void *arg TSRMLS_DC)
{
zval *name_array = (zval *)arg;
- add_next_index_string(name_array, ext->name, 1);
+ add_next_index_string(name_array, ext->name);
return 0;
}
@@ -2140,7 +2139,7 @@ ZEND_FUNCTION(debug_print_backtrace)
if (build_filename_arg && include_filename) {
array_init(&arg_array);
- add_next_index_string(&arg_array, (char*)include_filename, 1);
+ add_next_index_string(&arg_array, (char*)include_filename);
}
call_type = NULL;
}
@@ -2225,7 +2224,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
if (skip->op_array) {
filename = skip->op_array->filename->val;
lineno = skip->opline->lineno;
- add_assoc_string_ex(&stack_frame, "file", sizeof("file")-1, (char*)filename, 1);
+ add_assoc_string_ex(&stack_frame, "file", sizeof("file")-1, (char*)filename);
add_assoc_long_ex(&stack_frame, "line", sizeof("line")-1, lineno);
/* try to fetch args only if an FCALL was just made - elsewise we're in the middle of a function
@@ -2263,7 +2262,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
NULL);
if (function_name) {
- add_assoc_string_ex(&stack_frame, "function", sizeof("function")-1, (char*)function_name, 1);
+ add_assoc_string_ex(&stack_frame, "function", sizeof("function")-1, (char*)function_name);
if (ptr->object) {
if (ptr->function_state.function->common.scope) {
@@ -2280,10 +2279,10 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
Z_ADDREF(object);
}
- add_assoc_string_ex(&stack_frame, "type", sizeof("type")-1, "->", 1);
+ add_assoc_string_ex(&stack_frame, "type", sizeof("type")-1, "->");
} else if (ptr->function_state.function->common.scope) {
add_assoc_str_ex(&stack_frame, "class", sizeof("class")-1, STR_COPY(ptr->function_state.function->common.scope->name));
- add_assoc_string_ex(&stack_frame, "type", sizeof("type")-1, "::", 1);
+ add_assoc_string_ex(&stack_frame, "type", sizeof("type")-1, "::");
}
if ((options & DEBUG_BACKTRACE_IGNORE_ARGS) == 0 &&
@@ -2337,11 +2336,11 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
if we have called include in the frame above - this is the file we have included.
*/
- add_next_index_string(&arg_array, (char*)include_filename, 1);
+ add_next_index_string(&arg_array, (char*)include_filename);
add_assoc_zval_ex(&stack_frame, "args", sizeof("args")-1, &arg_array);
}
- add_assoc_string_ex(&stack_frame, "function", sizeof("function")-1, (char*)function_name, 1);
+ add_assoc_string_ex(&stack_frame, "function", sizeof("function")-1, (char*)function_name);
}
add_next_index_zval(return_value, &stack_frame);
diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c
index 238718b0ce..548dc06b93 100644
--- a/Zend/zend_closures.c
+++ b/Zend/zend_closures.c
@@ -338,8 +338,8 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp TSRMLS_
}
info_len = zend_spprintf(&info, 0, "%s",
i >= required ? "<optional>" : "<required>");
-//??? TODO: avoid reallocation
- add_assoc_stringl_ex(&val, name, name_len, info, info_len, 1);
+ // TODO: avoid reallocation ???
+ add_assoc_stringl_ex(&val, name, name_len, info, info_len);
efree(info);
efree(name);
arg_info++;
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 507cad8cee..20a4a78c39 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -298,7 +298,6 @@ ZEND_API zend_bool zend_is_compiling(TSRMLS_D) /* {{{ */
static zend_uint get_temporary_variable(zend_op_array *op_array) /* {{{ */
{
-//??? return (zend_uint)(zend_uintptr_t)EX_VAR_NUM_2(0, (op_array->T)++);
return (zend_uint)op_array->T++;
}
/* }}} */
@@ -351,8 +350,6 @@ static inline void zend_insert_literal(zend_op_array *op_array, zval *zv, int li
}
}
ZVAL_COPY_VALUE(&CONSTANT_EX(op_array, literal_position), zv);
-//??? Z_SET_REFCOUNT(CONSTANT_EX(op_array, literal_position), 2);
-//??? Z_SET_ISREF(CONSTANT_EX(op_array, literal_position));
op_array->literals[literal_position].cache_slot = -1;
}
/* }}} */
@@ -1900,7 +1897,6 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ
}
CG(active_op_array)->arg_info = erealloc(CG(active_op_array)->arg_info, sizeof(zend_arg_info)*(CG(active_op_array)->num_args));
cur_arg_info = &CG(active_op_array)->arg_info[CG(active_op_array)->num_args-1];
-//??? cur_arg_info->name = zend_new_interned_string(estrndup(Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant)), Z_STRLEN(varname->u.constant) + 1, 1 TSRMLS_CC);
cur_arg_info->name = estrndup(Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant));
cur_arg_info->name_len = Z_STRLEN(varname->u.constant);
cur_arg_info->type_hint = 0;
@@ -1941,7 +1937,7 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ
if (IS_INTERNED(Z_STR(class_type->u.constant))) {
Z_TYPE_FLAGS(class_type->u.constant) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
}
-//???: for now we have to copy it :(
+// TODO: for now we have to copy it ???
#if 1
cur_arg_info->class_name = estrndup(Z_STRVAL(class_type->u.constant), Z_STRLEN(class_type->u.constant));
cur_arg_info->class_name_len = Z_STRLEN(class_type->u.constant);
@@ -2583,7 +2579,6 @@ void zend_do_end_function_call(znode *function_name, znode *result, const znode
SET_NODE(opline->op1, function_name);
SET_UNUSED(opline->op2);
opline->op2.num = CG(context).nested_calls;
-//??? CALCULATE_LITERAL_HASH(opline->op1.constant);
GET_CACHE_SLOT(opline->op1.constant);
} else {
opline->opcode = ZEND_DO_FCALL_BY_NAME;
@@ -3487,7 +3482,6 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{
int use_copy;
ZVAL_DUP(&zv, precv->op2.zv);
-//??? INIT_PZVAL(zv);
zval_update_constant_ex(&zv, (void*)1, fptr->common.scope TSRMLS_CC);
if (Z_TYPE(zv) == IS_BOOL) {
if (Z_LVAL(zv)) {
@@ -5477,7 +5471,6 @@ void zend_do_declare_property(znode *var_name, const znode *value, zend_uint acc
Z_TYPE_FLAGS(var_name->u.constant) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
}
zend_declare_property_ex(CG(active_class_entry), Z_STR(var_name->u.constant), &property, access_type, comment TSRMLS_CC);
-//??? efree(Z_STRVAL(var_name->u.constant));
STR_RELEASE(Z_STR(var_name->u.constant));
}
/* }}} */
@@ -5554,7 +5547,6 @@ void zend_do_fetch_property(znode *result, znode *object, const znode *property
break;
}
if (opline_ptr->op2_type == IS_CONST && Z_TYPE(CONSTANT(opline_ptr->op2.constant)) == IS_STRING) {
-//??? CALCULATE_LITERAL_HASH(opline_ptr->op2.constant);
GET_POLYMORPHIC_CACHE_SLOT(opline_ptr->op2.constant);
}
GET_NODE(result, opline_ptr->result);
@@ -5579,7 +5571,6 @@ void zend_do_fetch_property(znode *result, znode *object, const znode *property
SET_NODE(opline.op1, object);
SET_NODE(opline.op2, property);
if (opline.op2_type == IS_CONST && Z_TYPE(CONSTANT(opline.op2.constant)) == IS_STRING) {
-//??? CALCULATE_LITERAL_HASH(opline.op2.constant);
GET_POLYMORPHIC_CACHE_SLOT(opline.op2.constant);
}
GET_NODE(result, opline.result);
@@ -5710,7 +5701,6 @@ static int zend_constant_ct_subst(znode *result, zval *const_name, int all_inter
result->op_type = IS_CONST;
result->u.constant = c->value;
zval_copy_ctor(&result->u.constant);
-//??? INIT_PZVAL(&result->u.constant);
return 1;
}
return 0;
@@ -5738,7 +5728,6 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con
}
zend_do_build_full_name(NULL, constant_container, constant_name, 1 TSRMLS_CC);
*result = *constant_container;
-//???
Z_TYPE_INFO(result->u.constant) = IS_CONSTANT_EX;
if (IS_INTERNED(Z_STR(result->u.constant))) {
Z_TYPE_FLAGS(result->u.constant) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
@@ -5764,7 +5753,6 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con
SET_NODE(opline->op1, constant_container);
}
SET_NODE(opline->op2, constant_name);
-//??? CALCULATE_LITERAL_HASH(opline->op2.constant);
if (opline->op1_type == IS_CONST) {
GET_CACHE_SLOT(opline->op2.constant);
} else {
@@ -5793,7 +5781,6 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con
}
*result = *constant_name;
-//???
Z_TYPE_INFO(result->u.constant) = IS_CONSTANT_EX;
if (IS_INTERNED(Z_STR(result->u.constant))) {
Z_TYPE_FLAGS(result->u.constant) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
@@ -5859,7 +5846,6 @@ void zend_do_shell_exec(znode *result, const znode *cmd TSRMLS_DC) /* {{{ */
opline->result.var = get_temporary_variable(CG(active_op_array));
opline->result_type = IS_VAR;
LITERAL_STR(opline->op1, STR_INIT("shell_exec", sizeof("shell_exec")-1, 0));
-//??? CALCULATE_LITERAL_HASH(opline->op1.constant);
opline->op1_type = IS_CONST;
GET_CACHE_SLOT(opline->op1.constant);
opline->extended_value = 1;
@@ -5896,8 +5882,6 @@ void zend_do_init_array(znode *result, const znode *expr, const znode *offset, z
if (numeric) {
zval_dtor(&CONSTANT(opline->op2.constant));
ZVAL_LONG(&CONSTANT(opline->op2.constant), index);
- } else {
-//??? CALCULATE_LITERAL_HASH(opline->op2.constant);
}
}
} else {
@@ -5928,8 +5912,6 @@ void zend_do_add_array_element(znode *result, const znode *expr, const znode *of
if (numeric) {
zval_dtor(&CONSTANT(opline->op2.constant));
ZVAL_LONG(&CONSTANT(opline->op2.constant), index);
- } else {
-//??? CALCULATE_LITERAL_HASH(opline->op2.constant);
}
}
} else {
@@ -5947,27 +5929,17 @@ void zend_do_add_static_array_element(znode *result, znode *offset, const znode
if (offset) {
switch (Z_TYPE(offset->u.constant)) {
case IS_CONSTANT:
-//??? /* Ugly hack to denote that this value has a constant index */
Z_GC_FLAGS(offset->u.constant) |= IS_STR_CONSTANT;
if (Z_CONST_FLAGS(offset->u.constant) & IS_CONSTANT_UNQUALIFIED) {
Z_GC_FLAGS(offset->u.constant) |= IS_STR_CONSTANT_UNQUALIFIED;
}
-//??? Z_TYPE(element) |= IS_CONSTANT_INDEX;
-//??? Z_STRVAL(offset->u.constant) = erealloc(Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+3);
-//??? Z_STRVAL(offset->u.constant)[Z_STRLEN(offset->u.constant)+1] = Z_TYPE(offset->u.constant);
-//??? Z_STRVAL(offset->u.constant)[Z_STRLEN(offset->u.constant)+2] = 0;
zend_symtable_update(Z_ARRVAL(result->u.constant), Z_STR(offset->u.constant), &element);
zval_dtor(&offset->u.constant);
break;
case IS_CONSTANT_AST: {
-//??? /* Another ugly hack to store the data about the AST in the array */
zend_string *key;
-//??? int len = sizeof(zend_ast *);
-//??? Z_TYPE(element) |= IS_CONSTANT_INDEX;
key = STR_INIT((char*)&Z_AST(offset->u.constant), sizeof(zend_ast*), 0);
GC_FLAGS(key) |= IS_STR_AST;
-//??? key[len] = Z_TYPE(offset->u.constant);
-//??? key[len + 1] = 0;
zend_symtable_update(Z_ARRVAL(result->u.constant), key, &element);
STR_RELEASE(key);
break;
@@ -6162,9 +6134,6 @@ void zend_do_fetch_static_variable(znode *varname, const znode *static_assignmen
opline->result_type = IS_VAR;
opline->result.var = get_temporary_variable(CG(active_op_array));
SET_NODE(opline->op1, varname);
-//??? if (opline->op1_type == IS_CONST) {
-//??? CALCULATE_LITERAL_HASH(opline->op1.constant);
-//??? }
SET_UNUSED(opline->op2);
opline->extended_value = ZEND_FETCH_STATIC;
GET_NODE(&result, opline->result);
@@ -6200,9 +6169,6 @@ void zend_do_fetch_lexical_variable(znode *varname, zend_bool is_ref TSRMLS_DC)
value.op_type = IS_CONST;
ZVAL_NULL(&value.u.constant);
Z_CONST_FLAGS(value.u.constant) = is_ref ? IS_LEXICAL_REF : IS_LEXICAL_VAR;
-//??? Z_SET_REFCOUNT_P(&value.u.constant, 1);
-//??? Z_UNSET_ISREF_P(&value.u.constant);
-
zend_do_fetch_static_variable(varname, &value, is_ref ? ZEND_FETCH_STATIC : ZEND_FETCH_LEXICAL TSRMLS_CC);
}
/* }}} */
@@ -6224,9 +6190,6 @@ void zend_do_fetch_global_variable(znode *varname, const znode *static_assignmen
opline->result_type = IS_VAR;
opline->result.var = get_temporary_variable(CG(active_op_array));
SET_NODE(opline->op1, varname);
-//??? if (opline->op1_type == IS_CONST) {
-//??? CALCULATE_LITERAL_HASH(opline->op1.constant);
-//??? }
SET_UNUSED(opline->op2);
opline->extended_value = fetch_type;
GET_NODE(&result, opline->result);
@@ -6936,7 +6899,6 @@ int zendlex(znode *zendlval TSRMLS_DC) /* {{{ */
}
again:
-//???
Z_TYPE_INFO(zendlval->u.constant) = IS_LONG;
retval = lex_scan(&zendlval->u.constant TSRMLS_CC);
switch (retval) {
@@ -6960,7 +6922,6 @@ again:
break;
}
-//??? INIT_PZVAL(&zendlval->u.constant);
zendlval->op_type = IS_CONST;
return retval;
}
@@ -7078,9 +7039,6 @@ void zend_do_build_namespace_name(znode *result, znode *prefix, znode *name TSRM
}
} else {
result->op_type = IS_CONST;
-//??? Z_TYPE(result->u.constant) = IS_STRING;
-//??? Z_STRVAL(result->u.constant) = NULL;
-//??? Z_STRLEN(result->u.constant) = 0;
ZVAL_EMPTY_STRING(&result->u.constant);
}
/* prefix = result */
@@ -7196,7 +7154,6 @@ void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{
name = &tmp;
p = zend_memrchr(Z_STRVAL(ns), '\\', Z_STRLEN(ns));
if (p) {
-//??? ZVAL_STRING(name, p+1, 1);
ZVAL_STRING(name, p+1);
} else {
ZVAL_ZVAL(name, &ns, 1, 0);
@@ -7274,7 +7231,6 @@ void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_global, int i
name = &tmp;
p = zend_memrchr(Z_STRVAL(ns), '\\', Z_STRLEN(ns));
if (p) {
-//??? ZVAL_STRING(name, p+1, 1);
ZVAL_STRING(name, p+1);
} else {
ZVAL_ZVAL(name, &ns, 1, 0);
@@ -7456,7 +7412,6 @@ void zend_do_constant_expression(znode *result, zend_ast *ast TSRMLS_DC) /* {{{
{
if (ast->kind == ZEND_CONST) {
ZVAL_COPY_VALUE(&result->u.constant, &ast->u.val);
-//???
efree(ast);
} else if (zend_ast_is_ct_constant(ast)) {
zend_ast_evaluate(&result->u.constant, ast, NULL TSRMLS_CC);
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index eb30107d21..b8ac4f9b1f 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -226,12 +226,10 @@ typedef struct _zend_property_info {
typedef struct _zend_arg_info {
- const char *name;
+ const char *name; // TODO: convert into zend_string ???
zend_uint name_len;
- const char *class_name;
+ const char *class_name; // TODO: convert into zend_string ???
zend_uint class_name_len;
-//??? zend_string *name;
-//??? zend_string *class_name;
zend_uchar type_hint;
zend_uchar pass_by_reference;
zend_bool allow_null;
@@ -384,7 +382,7 @@ struct _zend_execute_data {
zval old_error_reporting;
zend_bool nested;
zval *return_value;
-//???
+ // TODO: simplify call sequence and remove current_* and call_* ???
zend_class_entry *current_scope;
zend_class_entry *current_called_scope;
zend_object *current_this;
diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c
index 964c7f8165..57e65a596b 100644
--- a/Zend/zend_constants.c
+++ b/Zend/zend_constants.c
@@ -483,7 +483,6 @@ ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
#endif
if (!(c->flags & CONST_CS)) {
-//??? /* keep in mind that c->name_len already contains the '\0' */
lowercase_name = STR_ALLOC(c->name->len, c->flags & CONST_PERSISTENT);
zend_str_tolower_copy(lowercase_name->val, c->name->val, c->name->len);
lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC);
@@ -508,7 +507,6 @@ ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
/* The internal __COMPILER_HALT_OFFSET__ is prefixed by NULL byte */
if (c->name->val[0] == '\0' && c->name->len > sizeof("\0__COMPILER_HALT_OFFSET__")-1
&& memcmp(name->val, "\0__COMPILER_HALT_OFFSET__", sizeof("\0__COMPILER_HALT_OFFSET__")) == 0) {
-//??? name++;
}
zend_error(E_NOTICE,"Constant %s already defined", name->val);
STR_RELEASE(c->name);
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index c59dd9d9dd..4272adedbd 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -448,10 +448,6 @@ static int _build_trace_args(zval *arg TSRMLS_DC, int num_args, va_list args, ze
class_name = zend_get_object_classname(Z_OBJ_P(arg) TSRMLS_CC);
TRACE_APPEND_STRL(class_name->val, class_name->len);
-//??? if(!dup) {
-//??? efree((char*)class_name);
-//??? }
-
TRACE_APPEND_STR("), ");
break;
}
@@ -652,7 +648,7 @@ ZEND_METHOD(exception, __toString)
* the result in uncaught exception handlers without memleaks. */
zend_update_property_string(default_exception_ce, getThis(), "string", sizeof("string")-1, str TSRMLS_CC);
-//??? RETURN_STRINGL(str, len, 0);
+ // TODO: avoid reallocation ???
RETVAL_STRINGL(str, len);
efree(str);
}
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 1fb209a650..0a1f9d6d6f 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -675,9 +675,11 @@ static inline void zend_assign_to_object(zval *retval, zval *object_ptr, zval *p
}
Z_DELREF_P(object);
} else {
-#endif
zend_error(E_WARNING, "Creating default object from empty value");
-//??? }
+ }
+#else
+ zend_error(E_WARNING, "Creating default object from empty value");
+#endif
zval_dtor(object);
object_init(object);
} else {
@@ -904,7 +906,6 @@ static inline zval* zend_assign_to_variable(zval *variable_ptr, zval *value TSRM
return variable_ptr;
} else {
if (Z_REFCOUNT_P(value) == 1) {
-//??? auto dereferencing
ZVAL_UNREF(value);
ZVAL_COPY(variable_ptr, value);
} else {
@@ -925,7 +926,6 @@ assign_simple:
} else if (is_ref != value) {
assign_ref:
if (Z_REFCOUNT_P(value) == 1) {
-//??? auto dereferencing
ZVAL_UNREF(value);
ZVAL_COPY(variable_ptr, value);
} else {
diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h
index 35ab8eb572..a7d97868fc 100644
--- a/Zend/zend_execute.h
+++ b/Zend/zend_execute.h
@@ -27,26 +27,6 @@
#include "zend_operators.h"
#include "zend_variables.h"
-//???typedef union _temp_variable {
-//??? zval tmp_var;
-//??? struct {
-//??? zval **ptr_ptr;
-//??? zval *ptr;
-//??? zend_bool fcall_returned_reference;
-//??? } var;
-//??? struct {
-//??? zval **ptr_ptr; /* shared with var.ptr_ptr */
-//??? zval *str;
-//??? zend_uint offset;
-//??? } str_offset;
-//??? struct {
-//??? zval **ptr_ptr; /* shared with var.ptr_ptr */
-//??? zval *ptr; /* shared with var.ptr */
-//??? HashPointer fe_pos;
-//??? } fe;
-//??? zend_class_entry *class_entry;
-//???} temp_variable;
-
BEGIN_EXTERN_C()
struct _zend_fcall_info;
ZEND_API extern void (*zend_execute_ex)(zend_execute_data *execute_data TSRMLS_DC);
@@ -77,12 +57,6 @@ static zend_always_inline void i_zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC
ZEND_ASSERT(zval_ptr != &EG(uninitialized_zval));
_zval_dtor_func_for_ptr(Z_COUNTED_P(zval_ptr) ZEND_FILE_LINE_CC);
} else {
-//??? if (Z_REFCOUNT_P(zval_ptr) == 1 && Z_ISREF_P(zval_ptr)) {
- /* convert reference to regular value */
-//??? zend_reference *ref = Z_REF_P(zval_ptr);
-//??? ZVAL_COPY_VALUE(zval_ptr, &ref->val);
-//??? efree_rel(ref);
-//??? }
GC_ZVAL_CHECK_POSSIBLE_ROOT(zval_ptr);
}
}
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 2ae2bff70e..fce8c85ea5 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -465,12 +465,6 @@ ZEND_API void _zval_internal_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC) /* {{{ *
Z_DELREF_P(zval_ptr);
if (Z_REFCOUNT_P(zval_ptr) == 0) {
_zval_internal_dtor_for_ptr(zval_ptr ZEND_FILE_LINE_CC);
-//??? } else if (Z_REFCOUNT_P(zval_ptr) == 1) {
-//??? if (Z_ISREF_P(zval_ptr)) {
-//??? zend_reference *ref = Z_REF_P(zval_ptr);
-//??? ZVAL_COPY_VALUE(zval_ptr, Z_REFVAL_P(zval_ptr));
-//??? efree(ref);
-//??? }
}
}
}
@@ -484,20 +478,18 @@ ZEND_API int zend_is_true(zval *op TSRMLS_DC) /* {{{ */
#include "../TSRM/tsrm_strtok_r.h"
-#define IS_VISITED_CONSTANT 0x080 //??? IS_CONSTANT_INDEX
+#define IS_VISITED_CONSTANT 0x080
#define IS_CONSTANT_VISITED(p) (Z_TYPE_P(p) & IS_VISITED_CONSTANT)
#define Z_REAL_TYPE_P(p) (Z_TYPE_P(p) & ~IS_VISITED_CONSTANT)
#define MARK_CONSTANT_VISITED(p) Z_TYPE_INFO_P(p) |= IS_VISITED_CONSTANT
static void zval_deep_copy(zval *p)
{
- zval value;
-
- ZVAL_DUP(&value, p);
-//??? Z_TYPE(value) &= ~IS_CONSTANT_INDEX;
-//??? zval_copy_ctor(&value);
-//??? Z_TYPE(value) = Z_TYPE_P(p);
- ZVAL_COPY_VALUE(p, &value);
+//??? zval value;
+//???
+//??? ZVAL_DUP(&value, p);
+//??? ZVAL_COPY_VALUE(p, &value);
+ zval_copy_ctor(p);
}
ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope TSRMLS_DC) /* {{{ */
@@ -1200,7 +1192,7 @@ ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *s
CG(interactive) = orig_interactive;
if (Z_TYPE(local_retval) != IS_UNDEF) {
if (retval_ptr) {
- COPY_PZVAL_TO_ZVAL(*retval_ptr, &local_retval);
+ ZVAL_COPY_VALUE(retval_ptr, &local_retval);
} else {
zval_ptr_dtor(&local_retval);
}
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c
index 41e0bfcb02..5e3f823c83 100644
--- a/Zend/zend_hash.c
+++ b/Zend/zend_hash.c
@@ -159,7 +159,6 @@ ZEND_API void zend_hash_to_packed(HashTable *ht)
{
HANDLE_BLOCK_INTERRUPTIONS();
ht->flags |= HASH_FLAG_PACKED;
-//??? pefree(ht->arHash, ht->flags & HASH_FLAG_PERSISTENT);
ht->arData = erealloc(ht->arData, ht->nTableSize * sizeof(Bucket));
ht->arHash = (zend_uint*)&uninitialized_bucket;
HANDLE_UNBLOCK_INTERRUPTIONS();
@@ -1034,7 +1033,7 @@ ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_fun
if (setTargetPointer && source->nInternalPointer == idx) {
target->nInternalPointer = INVALID_IDX;
}
-//???
+ /* INDIRECT element may point to UNDEF-ined slots */
data = &p->val;
if (Z_TYPE_P(data) == IS_INDIRECT) {
data = Z_INDIRECT_P(data);
@@ -1614,7 +1613,6 @@ ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func,
} else {
if (renumber) {
ht->flags |= HASH_FLAG_PACKED;
-//??? pefree(ht->arHash, ht->flags & HASH_FLAG_PERSISTENT);
ht->arData = erealloc(ht->arData, ht->nTableSize * sizeof(Bucket));
ht->arHash = (zend_uint*)&uninitialized_bucket;
} else {
diff --git a/Zend/zend_ini.h b/Zend/zend_ini.h
index 971a574f8f..8782ec6f20 100644
--- a/Zend/zend_ini.h
+++ b/Zend/zend_ini.h
@@ -63,17 +63,17 @@
struct _zend_ini_entry {
int module_number;
int modifiable;
- char *name;
+ char *name; // TODO: convert into zend_string ???
uint name_length;
ZEND_INI_MH((*on_modify));
void *mh_arg1;
void *mh_arg2;
void *mh_arg3;
- char *value;
+ char *value; // TODO: convert into zend_string ???
uint value_length;
- char *orig_value;
+ char *orig_value; // TODO: convert into zend_string ???
uint orig_value_length;
int orig_modifiable;
int modified;
diff --git a/Zend/zend_iterators.c b/Zend/zend_iterators.c
index b626ef5e35..faf4f91d84 100644
--- a/Zend/zend_iterators.c
+++ b/Zend/zend_iterators.c
@@ -56,8 +56,6 @@ static zend_object_handlers iterator_object_handlers = {
ZEND_API void zend_register_iterator_wrapper(TSRMLS_D)
{
INIT_CLASS_ENTRY(zend_iterator_class_entry, "__iterator_wrapper", NULL);
-//??? STR_RELEASE(zend_iterator_class_entry.name);
-//??? zend_iterator_class_entry.name = STR_INIT("__iterator_wrapper", sizeof("__iterator_wrapper")-1, 0);
}
static void iter_wrapper_dtor(zend_object *object TSRMLS_DC)
diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c
index ae89317099..3d97aaaf7a 100644
--- a/Zend/zend_objects_API.c
+++ b/Zend/zend_objects_API.c
@@ -201,32 +201,6 @@ ZEND_API void zend_objects_store_del(zend_object *object TSRMLS_DC) /* {{{ */
}
/* }}} */
-//???
-#if 0
-ZEND_API zend_object *zend_objects_store_clone_obj(zval *zobject TSRMLS_DC)
-{
- zend_object *obj, *new_object;
-//??? struct _store_object *obj;
-//??? zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
-
-//??? obj = &EG(objects_store).object_buckets[handle].bucket.obj;
-
-//??? if (obj->clone == NULL) {
-//??? zend_error(E_CORE_ERROR, "Trying to clone uncloneable object of class %s", Z_OBJCE_P(zobject)->name);
-//??? }
-
- obj = Z_OBJ_P(zobject);
- new_object = obj->handlers->clone_obj(obj TSRMLS_CC);
- obj = &EG(objects_store).object_buckets[handle].bucket.obj;
-
- retval.handle = zend_objects_store_put(new_object, obj->dtor, obj->free_storage, obj->clone TSRMLS_CC);
- retval.handlers = Z_OBJ_HT_P(zobject);
- EG(objects_store).object_buckets[handle].bucket.obj.handlers = retval.handlers;
-
- return retval;
-}
-#endif
-
/* zend_object_store_set_object:
* It is ONLY valid to call this function from within the constructor of an
* overloaded object. Its purpose is to set the object pointer for the object
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index 7f339603e4..f0883e8ccb 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -419,10 +419,8 @@ ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC)
}
if (op_array->arg_info) {
for (i=0; i<op_array->num_args; i++) {
-//??? str_efree(op_array->arg_info[i].name);
efree((char*)op_array->arg_info[i].name);
if (op_array->arg_info[i].class_name) {
-//??? str_efree(op_array->arg_info[i].class_name);
efree((char*)op_array->arg_info[i].class_name);
}
}
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index db6502ce66..1460eb3670 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -245,7 +245,6 @@ try_again:
(op) = &(holder); \
break; \
case IS_RESOURCE: \
- /* ??? delete old resource ??? */ \
ZVAL_LONG(&(holder), Z_RES_HANDLE_P(op)); \
(op) = &(holder); \
break; \
@@ -291,7 +290,6 @@ try_again:
ZVAL_LONG(&(holder), Z_LVAL_P(op)); \
break; \
case IS_RESOURCE: \
- /* ??? delete old resource ??? */ \
ZVAL_LONG(&holder, Z_RES_HANDLE_P(op)); \
break; \
default: \
@@ -590,19 +588,7 @@ ZEND_API void convert_to_boolean(zval *op) /* {{{ */
ZEND_API void _convert_to_cstring(zval *op ZEND_FILE_LINE_DC) /* {{{ */
{
-//??? double dval;
-//??? switch (Z_TYPE_P(op)) {
-//??? case IS_DOUBLE: {
-//??? TSRMLS_FETCH();
-//??? dval = Z_DVAL_P(op);
-//??? Z_STRLEN_P(op) = zend_spprintf((char**)&Z_STRVAL_P(op), 0, "%.*H", (int) EG(precision), dval);
-//??? /* %H already handles removing trailing zeros from the fractional part, yay */
-//??? break;
-//??? }
-//??? default:
- _convert_to_string(op ZEND_FILE_LINE_CC);
-//??? }
-//??? Z_TYPE_P(op) = IS_STRING;
+ _convert_to_string(op ZEND_FILE_LINE_CC);
}
/* }}} */
@@ -681,7 +667,6 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */
break;
}
default:
- //??? op is set to be IS_STRING below.
zval_dtor(op);
ZVAL_BOOL(op, 0);
break;
@@ -1753,9 +1738,12 @@ ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
ZVAL_BOOL(result, Z_DVAL_P(op1) == Z_DVAL_P(op2));
break;
case IS_STRING:
-// TODO: interned strings ???
- ZVAL_BOOL(result, (Z_STRLEN_P(op1) == Z_STRLEN_P(op2))
- && (!memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1))));
+ if (Z_STR_P(op1) == Z_STR_P(op2)) {
+ ZVAL_BOOL(result, 1);
+ } else {
+ ZVAL_BOOL(result, (Z_STRLEN_P(op1) == Z_STRLEN_P(op2))
+ && (!memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1))));
+ }
break;
case IS_ARRAY:
ZVAL_BOOL(result, Z_ARRVAL_P(op1) == Z_ARRVAL_P(op2) ||
diff --git a/Zend/zend_string.c b/Zend/zend_string.c
index aafd8da5bb..730312009d 100644
--- a/Zend/zend_string.c
+++ b/Zend/zend_string.c
@@ -76,8 +76,6 @@ void zend_interned_strings_dtor(TSRMLS_D)
{
#ifndef ZTS
zend_hash_destroy(&CG(interned_strings));
-//??? free(CG(interned_strings).arData);
-//??? free(CG(interned_strings).arHash);
#else
free(CG(empty_string));
#endif
@@ -110,25 +108,8 @@ static zend_string *zend_new_interned_string_int(zend_string *str TSRMLS_DC)
}
GC_REFCOUNT(str) = 1;
-// str->gc.u.v.type = IS_INTERNED_STRING;
GC_FLAGS(str) |= IS_STR_INTERNED;
-//??? if (CG(interned_strings_top) + ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength) >=
-//??? CG(interned_strings_end)) {
-//??? /* no memory */
-//??? return arKey;
-//??? }
-
-//??? info = (zend_string_info*) CG(interned_strings_top);
-//??? CG(interned_strings_top) += ZEND_MM_ALIGNED_SIZE(sizeof(zend_string_info) + nKeyLength);
-
-//??? memcpy((char*)(info+1), arKey, nKeyLength);
-//??? if (free_src) {
-//??? efree((void *)arKey);
-//??? }
-//??? info->nKeyLength = nKeyLength;
-//??? info->h = h;
-
if (CG(interned_strings).nNumUsed >= CG(interned_strings).nTableSize) {
if ((CG(interned_strings).nTableSize << 1) > 0) { /* Let's double the table size */
Bucket *d = (Bucket *) perealloc_recoverable(CG(interned_strings).arData, (CG(interned_strings).nTableSize << 1) * sizeof(Bucket), CG(interned_strings).flags & HASH_FLAG_PERSISTENT);
diff --git a/Zend/zend_types.h b/Zend/zend_types.h
index 4390d99232..6b35b2af9b 100644
--- a/Zend/zend_types.h
+++ b/Zend/zend_types.h
@@ -168,7 +168,7 @@ struct _zend_array {
struct _zend_object {
zend_refcounted gc;
- zend_uint handle; //??? may be removed?
+ zend_uint handle; // TODO: may be removed ???
zend_class_entry *ce;
const zend_object_handlers *handlers;
HashTable *properties;
@@ -178,7 +178,7 @@ struct _zend_object {
struct _zend_resource {
zend_refcounted gc;
- long handle; //??? may be removed?
+ long handle; // TODO: may be removed ???
int type;
void *ptr;
};
@@ -218,12 +218,8 @@ static inline zend_uchar zval_get_type(const zval* pz) {
return pz->u1.v.type;
}
-//???
-#if 0
-# define Z_TYPE(zval) (zval).u1.v.type
-#else
-# define Z_TYPE(zval) zval_get_type(&(zval))
-#endif
+/* we should never set just Z_TYPE, we should set Z_TYPE_INFO */
+#define Z_TYPE(zval) zval_get_type(&(zval))
#define Z_TYPE_P(zval_p) Z_TYPE(*(zval_p))
#define Z_TYPE_FLAGS(zval) (zval).u1.v.type_flags
diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c
index 9661af1773..32fb706982 100644
--- a/Zend/zend_variables.c
+++ b/Zend/zend_variables.c
@@ -33,7 +33,7 @@ ZEND_API void _zval_dtor_func(zend_refcounted *p ZEND_FILE_LINE_DC)
case IS_STRING:
case IS_CONSTANT: {
zend_string *str = (zend_string*)p;
-//??? CHECK_ZVAL_STRING_REL(zvalue);
+ CHECK_ZVAL_STRING_REL(str);
STR_RELEASE(str);
break;
}
@@ -94,7 +94,7 @@ ZEND_API void _zval_dtor_func_for_ptr(zend_refcounted *p ZEND_FILE_LINE_DC)
case IS_STRING:
case IS_CONSTANT: {
zend_string *str = (zend_string*)p;
-//??? CHECK_ZVAL_STRING_REL(zvalue);
+ CHECK_ZVAL_STRING_REL(str);
STR_FREE(str);
break;
}
@@ -151,7 +151,7 @@ ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC)
switch (Z_TYPE_P(zvalue)) {
case IS_STRING:
case IS_CONSTANT:
- CHECK_ZVAL_STRING_REL(zvalue);
+ CHECK_ZVAL_STRING_REL(Z_STR_P(zvalue));
STR_RELEASE(Z_STR_P(zvalue));
break;
case IS_ARRAY:
@@ -182,7 +182,7 @@ ZEND_API void _zval_internal_dtor_for_ptr(zval *zvalue ZEND_FILE_LINE_DC)
switch (Z_TYPE_P(zvalue)) {
case IS_STRING:
case IS_CONSTANT:
- CHECK_ZVAL_STRING_REL(zvalue);
+ CHECK_ZVAL_STRING_REL(Z_STR_P(zvalue));
STR_FREE(Z_STR_P(zvalue));
break;
case IS_ARRAY:
@@ -211,7 +211,6 @@ ZEND_API void _zval_internal_dtor_for_ptr(zval *zvalue ZEND_FILE_LINE_DC)
ZEND_API void zval_add_ref(zval *p)
{
if (Z_REFCOUNTED_P(p)) {
-//???: autoconversion from reverence to ordinal value
if (Z_ISREF_P(p) && Z_REFCOUNT_P(p) == 1) {
ZVAL_DUP(p, Z_REFVAL_P(p));
} else {
@@ -236,7 +235,7 @@ ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC)
switch (Z_TYPE_P(zvalue)) {
case IS_CONSTANT:
case IS_STRING:
- CHECK_ZVAL_STRING_REL(zvalue);
+ CHECK_ZVAL_STRING_REL(Z_STR_P(zvalue));
Z_STR_P(zvalue) = STR_DUP(Z_STR_P(zvalue), 0);
break;
case IS_ARRAY:
diff --git a/Zend/zend_variables.h b/Zend/zend_variables.h
index 848efa3bf4..686c57ecf2 100644
--- a/Zend/zend_variables.h
+++ b/Zend/zend_variables.h
@@ -95,7 +95,6 @@ ZEND_API void _zval_internal_ptr_dtor_wrapper(zval *zvalue);
#endif
ZEND_API void zval_add_ref(zval *p);
-//??? previously references become regular values when refcount became 1
ZEND_API void zval_add_ref_unref(zval *p);
END_EXTERN_C()