mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
Generalize HashTableIterator API to allows its usage without iinvolvement of HashTable.nInternalPonter
This commit is contained in:
parent
5406f21b11
commit
1e41295097
@ -193,7 +193,7 @@ ZEND_API void zend_hash_set_apply_protection(HashTable *ht, zend_bool bApplyProt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ZEND_API uint32_t zend_hash_iterator_add(HashTable *ht)
|
ZEND_API uint32_t zend_hash_iterator_add(HashTable *ht, HashPosition pos)
|
||||||
{
|
{
|
||||||
HashTableIterator *iter = EG(ht_iterators);
|
HashTableIterator *iter = EG(ht_iterators);
|
||||||
HashTableIterator *end = iter + EG(ht_iterators_count);
|
HashTableIterator *end = iter + EG(ht_iterators_count);
|
||||||
@ -205,7 +205,7 @@ ZEND_API uint32_t zend_hash_iterator_add(HashTable *ht)
|
|||||||
while (iter != end) {
|
while (iter != end) {
|
||||||
if (iter->ht == NULL) {
|
if (iter->ht == NULL) {
|
||||||
iter->ht = ht;
|
iter->ht = ht;
|
||||||
iter->pos = ht->nInternalPointer;
|
iter->pos = pos;
|
||||||
idx = iter - EG(ht_iterators);
|
idx = iter - EG(ht_iterators);
|
||||||
if (idx + 1 > EG(ht_iterators_used)) {
|
if (idx + 1 > EG(ht_iterators_used)) {
|
||||||
EG(ht_iterators_used) = idx + 1;
|
EG(ht_iterators_used) = idx + 1;
|
||||||
@ -223,7 +223,7 @@ ZEND_API uint32_t zend_hash_iterator_add(HashTable *ht)
|
|||||||
iter = EG(ht_iterators) + EG(ht_iterators_count);
|
iter = EG(ht_iterators) + EG(ht_iterators_count);
|
||||||
EG(ht_iterators_count) += 8;
|
EG(ht_iterators_count) += 8;
|
||||||
iter->ht = ht;
|
iter->ht = ht;
|
||||||
iter->pos = ht->nInternalPointer;
|
iter->pos = pos;
|
||||||
memset(iter + 1, 0, sizeof(HashTableIterator) * 7);
|
memset(iter + 1, 0, sizeof(HashTableIterator) * 7);
|
||||||
idx = iter - EG(ht_iterators);
|
idx = iter - EG(ht_iterators);
|
||||||
EG(ht_iterators_used) = idx + 1;
|
EG(ht_iterators_used) = idx + 1;
|
||||||
|
@ -226,7 +226,7 @@ void zend_hash_display(const HashTable *ht);
|
|||||||
ZEND_API int _zend_handle_numeric_str_ex(const char *key, size_t length, zend_ulong *idx);
|
ZEND_API int _zend_handle_numeric_str_ex(const char *key, size_t length, zend_ulong *idx);
|
||||||
|
|
||||||
|
|
||||||
ZEND_API uint32_t zend_hash_iterator_add(HashTable *ht);
|
ZEND_API uint32_t zend_hash_iterator_add(HashTable *ht, HashPosition pos);
|
||||||
ZEND_API HashPosition zend_hash_iterator_pos(uint32_t idx, HashTable *ht);
|
ZEND_API HashPosition zend_hash_iterator_pos(uint32_t idx, HashTable *ht);
|
||||||
ZEND_API void zend_hash_iterator_del(uint32_t idx);
|
ZEND_API void zend_hash_iterator_del(uint32_t idx);
|
||||||
ZEND_API HashPosition zend_hash_iterators_lower_pos(HashTable *ht, HashPosition start);
|
ZEND_API HashPosition zend_hash_iterators_lower_pos(HashTable *ht, HashPosition start);
|
||||||
|
@ -4693,7 +4693,7 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET_R, CONST|TMP|VAR|CV, ANY)
|
|||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
fe_ht->nInternalPointer = pos;
|
fe_ht->nInternalPointer = pos;
|
||||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht);
|
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht, pos);
|
||||||
|
|
||||||
FREE_OP1_IF_VAR();
|
FREE_OP1_IF_VAR();
|
||||||
CHECK_EXCEPTION();
|
CHECK_EXCEPTION();
|
||||||
@ -4804,7 +4804,7 @@ ZEND_VM_HANDLER(125, ZEND_FE_RESET_RW, CONST|TMP|VAR|CV, ANY)
|
|||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
fe_ht->nInternalPointer = pos;
|
fe_ht->nInternalPointer = pos;
|
||||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht);
|
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht, pos);
|
||||||
|
|
||||||
FREE_OP1_VAR_PTR();
|
FREE_OP1_VAR_PTR();
|
||||||
CHECK_EXCEPTION();
|
CHECK_EXCEPTION();
|
||||||
@ -4840,7 +4840,7 @@ ZEND_VM_HANDLER(125, ZEND_FE_RESET_RW, CONST|TMP|VAR|CV, ANY)
|
|||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
fe_ht->nInternalPointer = pos;
|
fe_ht->nInternalPointer = pos;
|
||||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht);
|
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht, pos);
|
||||||
|
|
||||||
FREE_OP1_VAR_PTR();
|
FREE_OP1_VAR_PTR();
|
||||||
CHECK_EXCEPTION();
|
CHECK_EXCEPTION();
|
||||||
|
@ -3104,7 +3104,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER
|
|||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
fe_ht->nInternalPointer = pos;
|
fe_ht->nInternalPointer = pos;
|
||||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht);
|
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht, pos);
|
||||||
|
|
||||||
CHECK_EXCEPTION();
|
CHECK_EXCEPTION();
|
||||||
ZEND_VM_NEXT_OPCODE();
|
ZEND_VM_NEXT_OPCODE();
|
||||||
@ -3213,7 +3213,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLE
|
|||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
fe_ht->nInternalPointer = pos;
|
fe_ht->nInternalPointer = pos;
|
||||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht);
|
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht, pos);
|
||||||
|
|
||||||
CHECK_EXCEPTION();
|
CHECK_EXCEPTION();
|
||||||
ZEND_VM_NEXT_OPCODE();
|
ZEND_VM_NEXT_OPCODE();
|
||||||
@ -3248,7 +3248,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLE
|
|||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
fe_ht->nInternalPointer = pos;
|
fe_ht->nInternalPointer = pos;
|
||||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht);
|
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht, pos);
|
||||||
|
|
||||||
CHECK_EXCEPTION();
|
CHECK_EXCEPTION();
|
||||||
ZEND_VM_NEXT_OPCODE();
|
ZEND_VM_NEXT_OPCODE();
|
||||||
@ -9101,7 +9101,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_A
|
|||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
fe_ht->nInternalPointer = pos;
|
fe_ht->nInternalPointer = pos;
|
||||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht);
|
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht, pos);
|
||||||
|
|
||||||
CHECK_EXCEPTION();
|
CHECK_EXCEPTION();
|
||||||
ZEND_VM_NEXT_OPCODE();
|
ZEND_VM_NEXT_OPCODE();
|
||||||
@ -9211,7 +9211,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_
|
|||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
fe_ht->nInternalPointer = pos;
|
fe_ht->nInternalPointer = pos;
|
||||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht);
|
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht, pos);
|
||||||
|
|
||||||
CHECK_EXCEPTION();
|
CHECK_EXCEPTION();
|
||||||
ZEND_VM_NEXT_OPCODE();
|
ZEND_VM_NEXT_OPCODE();
|
||||||
@ -9246,7 +9246,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_
|
|||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
fe_ht->nInternalPointer = pos;
|
fe_ht->nInternalPointer = pos;
|
||||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht);
|
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht, pos);
|
||||||
|
|
||||||
CHECK_EXCEPTION();
|
CHECK_EXCEPTION();
|
||||||
ZEND_VM_NEXT_OPCODE();
|
ZEND_VM_NEXT_OPCODE();
|
||||||
@ -12001,7 +12001,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_A
|
|||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
fe_ht->nInternalPointer = pos;
|
fe_ht->nInternalPointer = pos;
|
||||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht);
|
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht, pos);
|
||||||
|
|
||||||
zval_ptr_dtor_nogc(free_op1);
|
zval_ptr_dtor_nogc(free_op1);
|
||||||
CHECK_EXCEPTION();
|
CHECK_EXCEPTION();
|
||||||
@ -12112,7 +12112,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_
|
|||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
fe_ht->nInternalPointer = pos;
|
fe_ht->nInternalPointer = pos;
|
||||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht);
|
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht, pos);
|
||||||
|
|
||||||
if (free_op1) {zval_ptr_dtor_nogc(free_op1);};
|
if (free_op1) {zval_ptr_dtor_nogc(free_op1);};
|
||||||
CHECK_EXCEPTION();
|
CHECK_EXCEPTION();
|
||||||
@ -12148,7 +12148,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_
|
|||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
fe_ht->nInternalPointer = pos;
|
fe_ht->nInternalPointer = pos;
|
||||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht);
|
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht, pos);
|
||||||
|
|
||||||
if (free_op1) {zval_ptr_dtor_nogc(free_op1);};
|
if (free_op1) {zval_ptr_dtor_nogc(free_op1);};
|
||||||
CHECK_EXCEPTION();
|
CHECK_EXCEPTION();
|
||||||
@ -24470,7 +24470,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_AR
|
|||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
fe_ht->nInternalPointer = pos;
|
fe_ht->nInternalPointer = pos;
|
||||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht);
|
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht, pos);
|
||||||
|
|
||||||
CHECK_EXCEPTION();
|
CHECK_EXCEPTION();
|
||||||
ZEND_VM_NEXT_OPCODE();
|
ZEND_VM_NEXT_OPCODE();
|
||||||
@ -24579,7 +24579,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_A
|
|||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
fe_ht->nInternalPointer = pos;
|
fe_ht->nInternalPointer = pos;
|
||||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht);
|
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht, pos);
|
||||||
|
|
||||||
CHECK_EXCEPTION();
|
CHECK_EXCEPTION();
|
||||||
ZEND_VM_NEXT_OPCODE();
|
ZEND_VM_NEXT_OPCODE();
|
||||||
@ -24614,7 +24614,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_A
|
|||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
fe_ht->nInternalPointer = pos;
|
fe_ht->nInternalPointer = pos;
|
||||||
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht);
|
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht, pos);
|
||||||
|
|
||||||
CHECK_EXCEPTION();
|
CHECK_EXCEPTION();
|
||||||
ZEND_VM_NEXT_OPCODE();
|
ZEND_VM_NEXT_OPCODE();
|
||||||
|
Loading…
Reference in New Issue
Block a user