Skip to content

Commit 85e1df6

Browse files
committed
Replace add_index_zval() and add_next_index_zval() functions by macros
1 parent 9acfe1f commit 85e1df6

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

Zend/zend_API.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,13 +1529,6 @@ ZEND_API int add_index_stringl(zval *arg, zend_ulong index, const char *str, siz
15291529
}
15301530
/* }}} */
15311531

1532-
ZEND_API int add_index_zval(zval *arg, zend_ulong index, zval *value) /* {{{ */
1533-
{
1534-
zend_hash_index_update(Z_ARRVAL_P(arg), index, value);
1535-
return SUCCESS;
1536-
}
1537-
/* }}} */
1538-
15391532
ZEND_API int add_next_index_long(zval *arg, zend_long n) /* {{{ */
15401533
{
15411534
zval tmp;
@@ -1608,12 +1601,6 @@ ZEND_API int add_next_index_stringl(zval *arg, const char *str, size_t length) /
16081601
}
16091602
/* }}} */
16101603

1611-
ZEND_API int add_next_index_zval(zval *arg, zval *value) /* {{{ */
1612-
{
1613-
return zend_hash_next_index_insert(Z_ARRVAL_P(arg), value) ? SUCCESS : FAILURE;
1614-
}
1615-
/* }}} */
1616-
16171604
ZEND_API zval *add_get_assoc_string_ex(zval *arg, const char *key, uint32_t key_len, const char *str) /* {{{ */
16181605
{
16191606
zval tmp, *ret;

Zend/zend_API.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,9 @@ ZEND_API int add_index_double(zval *arg, zend_ulong idx, double d);
412412
ZEND_API int add_index_str(zval *arg, zend_ulong idx, zend_string *str);
413413
ZEND_API int add_index_string(zval *arg, zend_ulong idx, const char *str);
414414
ZEND_API int add_index_stringl(zval *arg, zend_ulong idx, const char *str, size_t length);
415-
ZEND_API int add_index_zval(zval *arg, zend_ulong index, zval *value);
415+
416+
#define add_index_zval(arg, index, value) \
417+
(zend_hash_index_update(Z_ARRVAL_P(arg), index, value) ? SUCCESS : FAILURE)
416418

417419
ZEND_API int add_next_index_long(zval *arg, zend_long n);
418420
ZEND_API int add_next_index_null(zval *arg);
@@ -422,7 +424,9 @@ ZEND_API int add_next_index_double(zval *arg, double d);
422424
ZEND_API int add_next_index_str(zval *arg, zend_string *str);
423425
ZEND_API int add_next_index_string(zval *arg, const char *str);
424426
ZEND_API int add_next_index_stringl(zval *arg, const char *str, size_t length);
425-
ZEND_API int add_next_index_zval(zval *arg, zval *value);
427+
428+
#define add_next_index_zval(arg, value) \
429+
(zend_hash_next_index_insert(Z_ARRVAL_P(arg), value) ? SUCCESS : FAILURE)
426430

427431
ZEND_API zval *add_get_assoc_string_ex(zval *arg, const char *key, uint32_t key_len, const char *str);
428432
ZEND_API zval *add_get_assoc_stringl_ex(zval *arg, const char *key, uint32_t key_len, const char *str, size_t length);

0 commit comments

Comments
 (0)