Skip to content

Commit b1ff152

Browse files
committed
Reimplement strtr()
1 parent 65e2ed6 commit b1ff152

File tree

3 files changed

+164
-296
lines changed

3 files changed

+164
-296
lines changed

Zend/zend_hash.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,15 @@ ZEND_API zval *_zend_hash_str_add_or_update(HashTable *ht, const char *str, int
313313
return ret;
314314
}
315315

316+
ZEND_API zval *zend_hash_index_add_empty_element(HashTable *ht, ulong h)
317+
{
318+
319+
zval dummy;
320+
321+
ZVAL_NULL(&dummy);
322+
return zend_hash_index_add(ht, h, &dummy);
323+
}
324+
316325
ZEND_API zval *zend_hash_add_empty_element(HashTable *ht, zend_string *key)
317326
{
318327

Zend/zend_hash.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ ZEND_API zval *_zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, zv
9696
#define zend_hash_next_index_insert(ht, pData) \
9797
_zend_hash_index_update_or_next_insert(ht, 0, pData, HASH_NEXT_INSERT ZEND_FILE_LINE_CC)
9898

99+
ZEND_API zval *zend_hash_index_add_empty_element(HashTable *ht, ulong h);
99100
ZEND_API zval *zend_hash_add_empty_element(HashTable *ht, zend_string *key);
100101
ZEND_API zval *zend_hash_str_add_empty_element(HashTable *ht, const char *key, int len);
101102

@@ -569,6 +570,10 @@ static inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht, HashPositio
569570
ZEND_HASH_FOREACH(ht, 0); \
570571
_ptr = Z_PTR_P(_z);
571572

573+
#define ZEND_HASH_FOREACH_NUM_KEY(ht, _h) \
574+
ZEND_HASH_FOREACH(ht, 0); \
575+
_h = _p->h;
576+
572577
#define ZEND_HASH_FOREACH_STR_KEY(ht, _key) \
573578
ZEND_HASH_FOREACH(ht, 0); \
574579
_key = _p->key;

0 commit comments

Comments
 (0)