mirror of
https://github.com/php/php-src.git
synced 2024-12-04 15:23:44 +08:00
Flesh out ZEND_HASH_REVERSE_FOREACH_* macros
Closes GH-6080.
This commit is contained in:
parent
311fa34246
commit
40e5238a00
@ -993,107 +993,146 @@ static zend_always_inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht,
|
|||||||
ZEND_HASH_FOREACH(ht, 0); \
|
ZEND_HASH_FOREACH(ht, 0); \
|
||||||
_bucket = _p;
|
_bucket = _p;
|
||||||
|
|
||||||
|
#define ZEND_HASH_REVERSE_FOREACH_BUCKET(ht, _bucket) \
|
||||||
|
ZEND_HASH_REVERSE_FOREACH(ht, 0); \
|
||||||
|
_bucket = _p;
|
||||||
|
|
||||||
#define ZEND_HASH_FOREACH_VAL(ht, _val) \
|
#define ZEND_HASH_FOREACH_VAL(ht, _val) \
|
||||||
ZEND_HASH_FOREACH(ht, 0); \
|
ZEND_HASH_FOREACH(ht, 0); \
|
||||||
_val = _z;
|
_val = _z;
|
||||||
|
|
||||||
|
#define ZEND_HASH_REVERSE_FOREACH_VAL(ht, _val) \
|
||||||
|
ZEND_HASH_REVERSE_FOREACH(ht, 0); \
|
||||||
|
_val = _z;
|
||||||
|
|
||||||
#define ZEND_HASH_FOREACH_VAL_IND(ht, _val) \
|
#define ZEND_HASH_FOREACH_VAL_IND(ht, _val) \
|
||||||
ZEND_HASH_FOREACH(ht, 1); \
|
ZEND_HASH_FOREACH(ht, 1); \
|
||||||
_val = _z;
|
_val = _z;
|
||||||
|
|
||||||
|
#define ZEND_HASH_REVERSE_FOREACH_VAL_IND(ht, _val) \
|
||||||
|
ZEND_HASH_REVERSE_FOREACH(ht, 1); \
|
||||||
|
_val = _z;
|
||||||
|
|
||||||
#define ZEND_HASH_FOREACH_PTR(ht, _ptr) \
|
#define ZEND_HASH_FOREACH_PTR(ht, _ptr) \
|
||||||
ZEND_HASH_FOREACH(ht, 0); \
|
ZEND_HASH_FOREACH(ht, 0); \
|
||||||
_ptr = Z_PTR_P(_z);
|
_ptr = Z_PTR_P(_z);
|
||||||
|
|
||||||
|
#define ZEND_HASH_REVERSE_FOREACH_PTR(ht, _ptr) \
|
||||||
|
ZEND_HASH_REVERSE_FOREACH(ht, 0); \
|
||||||
|
_ptr = Z_PTR_P(_z);
|
||||||
|
|
||||||
#define ZEND_HASH_FOREACH_NUM_KEY(ht, _h) \
|
#define ZEND_HASH_FOREACH_NUM_KEY(ht, _h) \
|
||||||
ZEND_HASH_FOREACH(ht, 0); \
|
ZEND_HASH_FOREACH(ht, 0); \
|
||||||
_h = _p->h;
|
_h = _p->h;
|
||||||
|
|
||||||
|
#define ZEND_HASH_REVERSE_FOREACH_NUM_KEY(ht, _h) \
|
||||||
|
ZEND_HASH_REVERSE_FOREACH(ht, 0); \
|
||||||
|
_h = _p->h;
|
||||||
|
|
||||||
#define ZEND_HASH_FOREACH_STR_KEY(ht, _key) \
|
#define ZEND_HASH_FOREACH_STR_KEY(ht, _key) \
|
||||||
ZEND_HASH_FOREACH(ht, 0); \
|
ZEND_HASH_FOREACH(ht, 0); \
|
||||||
_key = _p->key;
|
_key = _p->key;
|
||||||
|
|
||||||
|
#define ZEND_HASH_REVERSE_FOREACH_STR_KEY(ht, _key) \
|
||||||
|
ZEND_HASH_REVERSE_FOREACH(ht, 0); \
|
||||||
|
_key = _p->key;
|
||||||
|
|
||||||
#define ZEND_HASH_FOREACH_KEY(ht, _h, _key) \
|
#define ZEND_HASH_FOREACH_KEY(ht, _h, _key) \
|
||||||
ZEND_HASH_FOREACH(ht, 0); \
|
ZEND_HASH_FOREACH(ht, 0); \
|
||||||
_h = _p->h; \
|
_h = _p->h; \
|
||||||
_key = _p->key;
|
_key = _p->key;
|
||||||
|
|
||||||
|
#define ZEND_HASH_REVERSE_FOREACH_KEY(ht, _h, _key) \
|
||||||
|
ZEND_HASH_REVERSE_FOREACH(ht, 0); \
|
||||||
|
_h = _p->h; \
|
||||||
|
_key = _p->key;
|
||||||
|
|
||||||
#define ZEND_HASH_FOREACH_NUM_KEY_VAL(ht, _h, _val) \
|
#define ZEND_HASH_FOREACH_NUM_KEY_VAL(ht, _h, _val) \
|
||||||
ZEND_HASH_FOREACH(ht, 0); \
|
ZEND_HASH_FOREACH(ht, 0); \
|
||||||
_h = _p->h; \
|
_h = _p->h; \
|
||||||
_val = _z;
|
_val = _z;
|
||||||
|
|
||||||
|
#define ZEND_HASH_REVERSE_FOREACH_NUM_KEY_VAL(ht, _h, _val) \
|
||||||
|
ZEND_HASH_REVERSE_FOREACH(ht, 0); \
|
||||||
|
_h = _p->h; \
|
||||||
|
_val = _z;
|
||||||
|
|
||||||
#define ZEND_HASH_FOREACH_STR_KEY_VAL(ht, _key, _val) \
|
#define ZEND_HASH_FOREACH_STR_KEY_VAL(ht, _key, _val) \
|
||||||
ZEND_HASH_FOREACH(ht, 0); \
|
ZEND_HASH_FOREACH(ht, 0); \
|
||||||
_key = _p->key; \
|
_key = _p->key; \
|
||||||
_val = _z;
|
_val = _z;
|
||||||
|
|
||||||
|
#define ZEND_HASH_REVERSE_FOREACH_STR_KEY_VAL(ht, _key, _val) \
|
||||||
|
ZEND_HASH_REVERSE_FOREACH(ht, 0); \
|
||||||
|
_key = _p->key; \
|
||||||
|
_val = _z;
|
||||||
|
|
||||||
#define ZEND_HASH_FOREACH_KEY_VAL(ht, _h, _key, _val) \
|
#define ZEND_HASH_FOREACH_KEY_VAL(ht, _h, _key, _val) \
|
||||||
ZEND_HASH_FOREACH(ht, 0); \
|
ZEND_HASH_FOREACH(ht, 0); \
|
||||||
_h = _p->h; \
|
_h = _p->h; \
|
||||||
_key = _p->key; \
|
_key = _p->key; \
|
||||||
_val = _z;
|
_val = _z;
|
||||||
|
|
||||||
|
#define ZEND_HASH_REVERSE_FOREACH_KEY_VAL(ht, _h, _key, _val) \
|
||||||
|
ZEND_HASH_REVERSE_FOREACH(ht, 0); \
|
||||||
|
_h = _p->h; \
|
||||||
|
_key = _p->key; \
|
||||||
|
_val = _z;
|
||||||
|
|
||||||
#define ZEND_HASH_FOREACH_STR_KEY_VAL_IND(ht, _key, _val) \
|
#define ZEND_HASH_FOREACH_STR_KEY_VAL_IND(ht, _key, _val) \
|
||||||
ZEND_HASH_FOREACH(ht, 1); \
|
ZEND_HASH_FOREACH(ht, 1); \
|
||||||
_key = _p->key; \
|
_key = _p->key; \
|
||||||
_val = _z;
|
_val = _z;
|
||||||
|
|
||||||
|
#define ZEND_HASH_REVERSE_FOREACH_STR_KEY_VAL_IND(ht, _key, _val) \
|
||||||
|
ZEND_HASH_REVERSE_FOREACH(ht, 1); \
|
||||||
|
_key = _p->key; \
|
||||||
|
_val = _z;
|
||||||
|
|
||||||
#define ZEND_HASH_FOREACH_KEY_VAL_IND(ht, _h, _key, _val) \
|
#define ZEND_HASH_FOREACH_KEY_VAL_IND(ht, _h, _key, _val) \
|
||||||
ZEND_HASH_FOREACH(ht, 1); \
|
ZEND_HASH_FOREACH(ht, 1); \
|
||||||
_h = _p->h; \
|
_h = _p->h; \
|
||||||
_key = _p->key; \
|
_key = _p->key; \
|
||||||
_val = _z;
|
_val = _z;
|
||||||
|
|
||||||
|
#define ZEND_HASH_REVERSE_FOREACH_KEY_VAL_IND(ht, _h, _key, _val) \
|
||||||
|
ZEND_HASH_REVERSE_FOREACH(ht, 1); \
|
||||||
|
_h = _p->h; \
|
||||||
|
_key = _p->key; \
|
||||||
|
_val = _z;
|
||||||
|
|
||||||
#define ZEND_HASH_FOREACH_NUM_KEY_PTR(ht, _h, _ptr) \
|
#define ZEND_HASH_FOREACH_NUM_KEY_PTR(ht, _h, _ptr) \
|
||||||
ZEND_HASH_FOREACH(ht, 0); \
|
ZEND_HASH_FOREACH(ht, 0); \
|
||||||
_h = _p->h; \
|
_h = _p->h; \
|
||||||
_ptr = Z_PTR_P(_z);
|
_ptr = Z_PTR_P(_z);
|
||||||
|
|
||||||
|
#define ZEND_HASH_REVERSE_FOREACH_NUM_KEY_PTR(ht, _h, _ptr) \
|
||||||
|
ZEND_HASH_REVERSE_FOREACH(ht, 0); \
|
||||||
|
_h = _p->h; \
|
||||||
|
_ptr = Z_PTR_P(_z);
|
||||||
|
|
||||||
#define ZEND_HASH_FOREACH_STR_KEY_PTR(ht, _key, _ptr) \
|
#define ZEND_HASH_FOREACH_STR_KEY_PTR(ht, _key, _ptr) \
|
||||||
ZEND_HASH_FOREACH(ht, 0); \
|
ZEND_HASH_FOREACH(ht, 0); \
|
||||||
_key = _p->key; \
|
_key = _p->key; \
|
||||||
_ptr = Z_PTR_P(_z);
|
_ptr = Z_PTR_P(_z);
|
||||||
|
|
||||||
|
#define ZEND_HASH_REVERSE_FOREACH_STR_KEY_PTR(ht, _key, _ptr) \
|
||||||
|
ZEND_HASH_REVERSE_FOREACH(ht, 0); \
|
||||||
|
_key = _p->key; \
|
||||||
|
_ptr = Z_PTR_P(_z);
|
||||||
|
|
||||||
#define ZEND_HASH_FOREACH_KEY_PTR(ht, _h, _key, _ptr) \
|
#define ZEND_HASH_FOREACH_KEY_PTR(ht, _h, _key, _ptr) \
|
||||||
ZEND_HASH_FOREACH(ht, 0); \
|
ZEND_HASH_FOREACH(ht, 0); \
|
||||||
_h = _p->h; \
|
_h = _p->h; \
|
||||||
_key = _p->key; \
|
_key = _p->key; \
|
||||||
_ptr = Z_PTR_P(_z);
|
_ptr = Z_PTR_P(_z);
|
||||||
|
|
||||||
#define ZEND_HASH_REVERSE_FOREACH_BUCKET(ht, _bucket) \
|
#define ZEND_HASH_REVERSE_FOREACH_KEY_PTR(ht, _h, _key, _ptr) \
|
||||||
ZEND_HASH_REVERSE_FOREACH(ht, 0); \
|
|
||||||
_bucket = _p;
|
|
||||||
|
|
||||||
#define ZEND_HASH_REVERSE_FOREACH_VAL(ht, _val) \
|
|
||||||
ZEND_HASH_REVERSE_FOREACH(ht, 0); \
|
|
||||||
_val = _z;
|
|
||||||
|
|
||||||
#define ZEND_HASH_REVERSE_FOREACH_PTR(ht, _ptr) \
|
|
||||||
ZEND_HASH_REVERSE_FOREACH(ht, 0); \
|
ZEND_HASH_REVERSE_FOREACH(ht, 0); \
|
||||||
|
_h = _p->h; \
|
||||||
|
_key = _p->key; \
|
||||||
_ptr = Z_PTR_P(_z);
|
_ptr = Z_PTR_P(_z);
|
||||||
|
|
||||||
#define ZEND_HASH_REVERSE_FOREACH_VAL_IND(ht, _val) \
|
|
||||||
ZEND_HASH_REVERSE_FOREACH(ht, 1); \
|
|
||||||
_val = _z;
|
|
||||||
|
|
||||||
#define ZEND_HASH_REVERSE_FOREACH_STR_KEY_VAL(ht, _key, _val) \
|
|
||||||
ZEND_HASH_REVERSE_FOREACH(ht, 0); \
|
|
||||||
_key = _p->key; \
|
|
||||||
_val = _z;
|
|
||||||
|
|
||||||
#define ZEND_HASH_REVERSE_FOREACH_KEY_VAL(ht, _h, _key, _val) \
|
|
||||||
ZEND_HASH_REVERSE_FOREACH(ht, 0); \
|
|
||||||
_h = _p->h; \
|
|
||||||
_key = _p->key; \
|
|
||||||
_val = _z;
|
|
||||||
|
|
||||||
#define ZEND_HASH_REVERSE_FOREACH_KEY_VAL_IND(ht, _h, _key, _val) \
|
|
||||||
ZEND_HASH_REVERSE_FOREACH(ht, 1); \
|
|
||||||
_h = _p->h; \
|
|
||||||
_key = _p->key; \
|
|
||||||
_val = _z;
|
|
||||||
|
|
||||||
/* The following macros are useful to insert a sequence of new elements
|
/* The following macros are useful to insert a sequence of new elements
|
||||||
* of packed array. They may be used instead of series of
|
* of packed array. They may be used instead of series of
|
||||||
* zend_hash_next_index_insert_new()
|
* zend_hash_next_index_insert_new()
|
||||||
|
Loading…
Reference in New Issue
Block a user