Esempio n. 1
0
/** @This allocates a uref.
 *
 * @param mgr common management structure
 * @return pointer to uref or NULL in case of allocation error
 */
static struct uref *uref_std_alloc(struct uref_mgr *mgr)
{
    struct uref_std_mgr *std_mgr = uref_std_mgr_from_uref_mgr(mgr);
    struct uref *uref = upool_alloc(&std_mgr->uref_pool, struct uref *);
    if (unlikely(uref == NULL))
        return NULL;
    uchain_init(&uref->uchain);
    uref_mgr_use(mgr);
    return uref;
}
Esempio n. 2
0
/* allocate es configuration */
static struct es_conf *es_conf_alloc(struct udict_mgr *mgr,
                                     uint64_t id, struct uchain *list)
{
    struct es_conf *conf = malloc(sizeof(struct es_conf));
    if (unlikely(conf == NULL))
        return NULL;
    memset(conf, 0, sizeof(struct es_conf));
    uchain_init(&conf->uchain);
    if (list) {
        ulist_add(list, &conf->uchain);
    }

    conf->options = udict_alloc(mgr, 0);
    conf->id = id;
    return conf;
}