Ejemplo n.º 1
0
ZEND_API void zend_hash_graceful_destroy(HashTable *ht)
{
	Bucket *p;

	IS_CONSISTENT(ht);

	p = ht->pListHead;
	while (p != NULL) {
		p = zend_hash_apply_deleter(ht, p);
	}
	pefree(ht->arBuckets, ht->persistent);

	SET_INCONSISTENT(HT_DESTROYED);
}
Ejemplo n.º 2
0
ZEND_API void zend_hash_graceful_reverse_destroy(HashTable *ht)
{
    Bucket *p;

    IS_CONSISTENT(ht);

    p = ht->pListTail;
    while (p != NULL) {
        zend_hash_apply_deleter(ht, p);
        p = ht->pListTail;
    }

    if (ht->nTableMask) {
        pefree(ht->arBuckets, ht->persistent);
    }

    SET_INCONSISTENT(HT_DESTROYED);
}
Ejemplo n.º 3
0
ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC)
{
    Bucket *p;

    IS_CONSISTENT(ht);

    HASH_PROTECT_RECURSION(ht);
    p = ht->pListHead;
    while (p != NULL) {
        int result = apply_func(p->pData TSRMLS_CC);

        if (result & ZEND_HASH_APPLY_REMOVE) {
            p = zend_hash_apply_deleter(ht, p);
        } else {
            p = p->pListNext;
        }
        if (result & ZEND_HASH_APPLY_STOP) {
            break;
        }
    }
    HASH_UNPROTECT_RECURSION(ht);
}