示例#1
0
文件: ee_oper.c 项目: B0SB05/ironbee
/**
 * Release resources when the module is unloaded.
 *
 * All eudoxus engines created by the LoadEudoxus directive are destroyed.
 *
 * @param[in] ib Ironbee engine.
 * @param[in] m Module instance.
 * @param[in] cbdata Not used.
 */
static
ib_status_t ee_module_finish(ib_engine_t *ib,
                             ib_module_t *m,
                             void        *cbdata)
{
    ib_status_t rc;
    ia_eudoxus_t *eudoxus;
    ib_mpool_lite_t *pool;
    const ee_config_t *config = ee_get_config(ib);
    ib_hash_t *eudoxus_pattern_hash;
    ib_hash_iterator_t *iterator;

    if (
        config                       == NULL ||
        config->eudoxus_pattern_hash == NULL
    ) {
        return IB_OK;
    }

    eudoxus_pattern_hash = config->eudoxus_pattern_hash;

    rc = ib_mpool_lite_create(&pool);
    if (rc != IB_OK) {
        return rc;
    }

    iterator = ib_hash_iterator_create(ib_mm_mpool_lite(pool));
    if (iterator == NULL) {
        ib_mpool_lite_destroy(pool);
        return IB_EALLOC;
    }
    for (
        ib_hash_iterator_first(iterator, eudoxus_pattern_hash);
        ! ib_hash_iterator_at_end(iterator);
        ib_hash_iterator_next(iterator)
    ) {
        ib_hash_iterator_fetch(NULL, NULL, &eudoxus, iterator);
        if (eudoxus != NULL) {
            ia_eudoxus_destroy(eudoxus);
        }
    }
    ib_hash_clear(eudoxus_pattern_hash);
    ib_mpool_lite_destroy(pool);

    return IB_OK;
}
示例#2
0
文件: hash.hpp 项目: PutiZL/ironbee
 //! Clear hash.
 void clear() const
 {
     ib_hash_clear(ib());
 }