예제 #1
0
파일: cfgmap.c 프로젝트: aburan28/ironbee
ib_status_t ib_cfgmap_create(ib_cfgmap_t **pcm,
                             ib_mpool_t *pool)
{
    ib_hash_t *hash;
    ib_status_t rc;

    /* Underlying hash structure. */
    rc = ib_hash_create_nocase(&hash, pool);
    if (rc != IB_OK) {
        rc = IB_EALLOC;
        goto failed;
    }
    pool = ib_hash_pool(hash);

    *pcm = (ib_cfgmap_t *)ib_mpool_alloc(pool, sizeof(**pcm));
    if (*pcm == NULL) {
        rc = IB_EALLOC;
        goto failed;
    }

    (*pcm)->mp = pool;
    (*pcm)->hash = hash;
    /* Set by ib_cfgmap_init() */
    (*pcm)->base = NULL;

    return IB_OK;

failed:
    /* Make sure everything is cleaned up on failure. */
    *pcm = NULL;

    return rc;
}
예제 #2
0
파일: hash.hpp 프로젝트: PutiZL/ironbee
 //! Memory manager used by hash.
 MemoryManager memory_manager() const
 {
     return MemoryManager(ib_hash_pool(ib()));
 }