Skip to content

Commit 050d7e3

Browse files
committed
Cleanup (1-st round)
1 parent 93d3a61 commit 050d7e3

File tree

139 files changed

+921
-1185
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+921
-1185
lines changed

Zend/zend.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop
242242
}
243243
case IS_BOOL:
244244
if (Z_LVAL_P(expr)) {
245-
// TODO: ??? use interned string
245+
// TODO: use interned string ???
246246
ZVAL_NEW_STR(expr_copy, STR_INIT("1", 1, 0));
247247
} else {
248248
TSRMLS_FETCH();
@@ -259,7 +259,7 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop
259259
break;
260260
case IS_ARRAY:
261261
zend_error(E_NOTICE, "Array to string conversion");
262-
// TODO: ??? use interned string
262+
// TODO: use interned string ???
263263
ZVAL_NEW_STR(expr_copy, STR_INIT("Array", sizeof("Array") - 1, 0));
264264
break;
265265
case IS_OBJECT:

Zend/zend.h

-52
Original file line numberDiff line numberDiff line change
@@ -583,11 +583,6 @@ ZEND_API void free_estring(char **str_p);
583583
ZEND_API void free_string_zval(zval *zv);
584584
END_EXTERN_C()
585585

586-
/* FIXME: Check if we can save if (ptr) too */
587-
588-
//???#define STR_FREE(ptr) if (ptr) { str_efree(ptr); }
589-
//???#define STR_FREE_REL(ptr) if (ptr) { str_efree_rel(ptr); }
590-
591586
/* output support */
592587
#define ZEND_WRITE(str, str_len) zend_write((str), (str_len))
593588
#define ZEND_WRITE_EX(str, str_len) write_func((str), (str_len))
@@ -680,18 +675,6 @@ END_EXTERN_C()
680675
} \
681676
} while (0)
682677

683-
//??? this macro should be used to get argument value passed by referebce
684-
//??? unfortunately it's not always work as expected
685-
#if 0
686-
#define ZVAL_DEREF_REF(z) do { \
687-
ZEND_ASSERT(Z_ISREF_P(z)); \
688-
(z) = Z_REFVAL_P(z); \
689-
} while (0)
690-
#else
691-
#define ZVAL_DEREF_REF(z) \
692-
ZVAL_DEREF(z)
693-
#endif
694-
695678
#define ZVAL_DUP_DEREF(z, v) \
696679
do { \
697680
zval *__z1 = (z); \
@@ -710,14 +693,6 @@ END_EXTERN_C()
710693
efree(ref); \
711694
} while (0)
712695

713-
// TODO: invalud ???
714-
#define INIT_PZVAL_COPY(z, v) \
715-
do { \
716-
ZVAL_COPY_VALUE(z, v); \
717-
Z_SET_REFCOUNT_P(z, 1); \
718-
Z_UNSET_ISREF_P(z); \
719-
} while (0)
720-
721696
#define SEPARATE_ZVAL(zv) do { \
722697
zval *_zv = (zv); \
723698
if (Z_REFCOUNTED_P(_zv)) { \
@@ -769,33 +744,6 @@ END_EXTERN_C()
769744
} \
770745
} while (0)
771746

772-
773-
// TODO: remove ???
774-
#define COPY_PZVAL_TO_ZVAL(zv, pzv) \
775-
ZVAL_COPY_VALUE(&(zv), (pzv)); \
776-
if (Z_OPT_REFCOUNTED_P(pzv)) { \
777-
if (Z_REFCOUNT_P(pzv)>1) { \
778-
zval_copy_ctor(&(zv)); \
779-
Z_DELREF_P((pzv)); \
780-
} \
781-
} \
782-
783-
// TODO: remove ???
784-
#define REPLACE_ZVAL_VALUE(ppzv_dest, pzv_src, copy) { \
785-
int is_ref, refcount; \
786-
\
787-
SEPARATE_ZVAL_IF_NOT_REF(ppzv_dest); \
788-
is_ref = Z_ISREF_PP(ppzv_dest); \
789-
refcount = Z_REFCOUNT_PP(ppzv_dest); \
790-
zval_dtor(*ppzv_dest); \
791-
ZVAL_COPY_VALUE(*ppzv_dest, pzv_src); \
792-
if (copy) { \
793-
zval_opt_copy_ctor(*ppzv_dest); \
794-
} \
795-
Z_SET_ISREF_TO_PP(ppzv_dest, is_ref); \
796-
Z_SET_REFCOUNT_PP(ppzv_dest, refcount); \
797-
}
798-
799747
#define SEPARATE_ARG_IF_REF(varptr) do { \
800748
zval *_varptr = (varptr); \
801749
if (Z_ISREF_P(_varptr)) { \

Zend/zend_API.c

+12-27
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,6 @@ ZEND_API void object_properties_init(zend_object *object, zend_class_entry *clas
12071207
int i;
12081208

12091209
if (class_type->default_properties_count) {
1210-
//??? object->properties_table = emalloc(sizeof(zval*) * class_type->default_properties_count);
12111210
for (i = 0; i < class_type->default_properties_count; i++) {
12121211
#if ZTS
12131212
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
13921391
}
13931392
/* }}} */
13941393

1395-
ZEND_API int add_assoc_string_ex(zval *arg, const char *key, uint key_len, char *str, int duplicate) /* {{{ */
1394+
ZEND_API int add_assoc_string_ex(zval *arg, const char *key, uint key_len, char *str) /* {{{ */
13961395
{
13971396
zval *ret, tmp;
13981397

1399-
//??? ZVAL_STRING(tmp, str, duplicate);
14001398
ZVAL_STRING(&tmp, str);
14011399
ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp);
14021400
return ret ? SUCCESS : FAILURE;
14031401
}
14041402
/* }}} */
14051403

1406-
ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, char *str, uint length, int duplicate) /* {{{ */
1404+
ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, char *str, uint length) /* {{{ */
14071405
{
14081406
zval *ret, tmp;
14091407

1410-
//??? ZVAL_STRINGL(tmp, str, length, duplicate);
14111408
ZVAL_STRINGL(&tmp, str, length);
14121409
ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp);
14131410
return ret ? SUCCESS : FAILURE;
@@ -1477,23 +1474,20 @@ ZEND_API int add_index_str(zval *arg, ulong index, zend_string *str) /* {{{ */
14771474
}
14781475
/* }}} */
14791476

1480-
ZEND_API int add_index_string(zval *arg, ulong index, const char *str, int duplicate) /* {{{ */
1477+
ZEND_API int add_index_string(zval *arg, ulong index, const char *str) /* {{{ */
14811478
{
14821479
zval tmp;
14831480

1484-
//??? ZVAL_STRING(tmp, str, duplicate);
14851481
ZVAL_STRING(&tmp, str);
14861482
return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp) ? SUCCESS : FAILURE;
14871483
}
14881484
/* }}} */
14891485

1490-
ZEND_API int add_index_stringl(zval *arg, ulong index, const char *str, uint length, int duplicate) /* {{{ */
1486+
ZEND_API int add_index_stringl(zval *arg, ulong index, const char *str, uint length) /* {{{ */
14911487
{
14921488
zval tmp;
14931489

1494-
//??? ZVAL_STRINGL(tmp, str, length, duplicate);
14951490
ZVAL_STRINGL(&tmp, str, length);
1496-
14971491
return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp) ? SUCCESS : FAILURE;
14981492
}
14991493
/* }}} */
@@ -1558,21 +1552,19 @@ ZEND_API int add_next_index_str(zval *arg, zend_string *str) /* {{{ */
15581552
}
15591553
/* }}} */
15601554

1561-
ZEND_API int add_next_index_string(zval *arg, const char *str, int duplicate) /* {{{ */
1555+
ZEND_API int add_next_index_string(zval *arg, const char *str) /* {{{ */
15621556
{
15631557
zval tmp;
15641558

1565-
//??? ZVAL_STRING(&tmp, str, duplicate);
15661559
ZVAL_STRING(&tmp, str);
15671560
return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp) ? SUCCESS : FAILURE;
15681561
}
15691562
/* }}} */
15701563

1571-
ZEND_API int add_next_index_stringl(zval *arg, const char *str, uint length, int duplicate) /* {{{ */
1564+
ZEND_API int add_next_index_stringl(zval *arg, const char *str, uint length) /* {{{ */
15721565
{
15731566
zval tmp;
15741567

1575-
//??? ZVAL_STRINGL(&tmp, str, length, duplicate);
15761568
ZVAL_STRINGL(&tmp, str, length);
15771569
return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp) ? SUCCESS : FAILURE;
15781570
}
@@ -1584,22 +1576,20 @@ ZEND_API int add_next_index_zval(zval *arg, zval *value) /* {{{ */
15841576
}
15851577
/* }}} */
15861578

1587-
ZEND_API zval *add_get_assoc_string_ex(zval *arg, const char *key, uint key_len, const char *str, int duplicate) /* {{{ */
1579+
ZEND_API zval *add_get_assoc_string_ex(zval *arg, const char *key, uint key_len, const char *str) /* {{{ */
15881580
{
15891581
zval tmp, *ret;
15901582

1591-
//??? ZVAL_STRING(tmp, str, duplicate);
15921583
ZVAL_STRING(&tmp, str);
15931584
ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp);
15941585
return ret;
15951586
}
15961587
/* }}} */
15971588

1598-
ZEND_API zval *add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, int duplicate) /* {{{ */
1589+
ZEND_API zval *add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length) /* {{{ */
15991590
{
16001591
zval tmp, *ret;
16011592

1602-
//??? ZVAL_STRING(tmp, str, length, duplicate);
16031593
ZVAL_STRINGL(&tmp, str, length);
16041594
ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp);
16051595
return ret;
@@ -1628,27 +1618,24 @@ ZEND_API zval *add_get_index_str(zval *arg, ulong index, zend_string *str) /* {{
16281618
{
16291619
zval tmp;
16301620

1631-
//??? ZVAL_STRING(tmp, str, duplicate);
16321621
ZVAL_STR(&tmp, str);
16331622
return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp);
16341623
}
16351624
/* }}} */
16361625

1637-
ZEND_API zval *add_get_index_string(zval *arg, ulong index, const char *str, int duplicate) /* {{{ */
1626+
ZEND_API zval *add_get_index_string(zval *arg, ulong index, const char *str) /* {{{ */
16381627
{
16391628
zval tmp;
16401629

1641-
//??? ZVAL_STRING(tmp, str, duplicate);
16421630
ZVAL_STRING(&tmp, str);
16431631
return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp);
16441632
}
16451633
/* }}} */
16461634

1647-
ZEND_API zval *add_get_index_stringl(zval *arg, ulong index, const char *str, uint length, int duplicate) /* {{{ */
1635+
ZEND_API zval *add_get_index_stringl(zval *arg, ulong index, const char *str, uint length) /* {{{ */
16481636
{
16491637
zval tmp;
16501638

1651-
//??? ZVAL_STRINGL(tmp, str, length, duplicate);
16521639
ZVAL_STRINGL(&tmp, str, length);
16531640
return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp);
16541641
}
@@ -1762,12 +1749,11 @@ ZEND_API int add_property_double_ex(zval *arg, const char *key, uint key_len, do
17621749
}
17631750
/* }}} */
17641751

1765-
ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, const char *str, int duplicate TSRMLS_DC) /* {{{ */
1752+
ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, const char *str TSRMLS_DC) /* {{{ */
17661753
{
17671754
zval tmp;
17681755
zval z_key;
17691756

1770-
//??? ZVAL_STRING(tmp, str, duplicate);
17711757
ZVAL_STRING(&tmp, str);
17721758
ZVAL_STRINGL(&z_key, key, key_len);
17731759
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
17771763
}
17781764
/* }}} */
17791765

1780-
ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, int duplicate TSRMLS_DC) /* {{{ */
1766+
ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length TSRMLS_DC) /* {{{ */
17811767
{
17821768
zval tmp;
17831769
zval z_key;
17841770

1785-
//??? ZVAL_STRINGL(tmp, str, length, duplicate);
17861771
ZVAL_STRINGL(&tmp, str, length);
17871772
ZVAL_STRINGL(&z_key, key, key_len);
17881773
Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, 0 TSRMLS_CC);

0 commit comments

Comments
 (0)