Ejemplo n.º 1
0
char *prs_alloc_mem(prs_struct *ps, size_t size, unsigned int count)
#endif
{
	char *ret = NULL;

	if (size && count) {
		/* We can't call the type-safe version here. */
		ret = (char *)_talloc_zero_array(ps->mem_ctx, size, count,
						 "parse_prs");
	}
	return ret;
}
Ejemplo n.º 2
0
int mgcp_endpoints_allocate(struct mgcp_trunk_config *tcfg)
{
    int i;

    /* Initialize all endpoints */
    tcfg->endpoints = _talloc_zero_array(tcfg->cfg,
                                         sizeof(struct mgcp_endpoint),
                                         tcfg->number_endpoints, "endpoints");
    if (!tcfg->endpoints)
        return -1;

    for (i = 0; i < tcfg->number_endpoints; ++i) {
        tcfg->endpoints[i].ci = CI_UNUSED;
        tcfg->endpoints[i].cfg = tcfg->cfg;
        tcfg->endpoints[i].tcfg = tcfg;
        mgcp_rtp_end_init(&tcfg->endpoints[i].net_end);
        mgcp_rtp_end_init(&tcfg->endpoints[i].bts_end);
        mgcp_rtp_end_init(&tcfg->endpoints[i].trans_net);
        mgcp_rtp_end_init(&tcfg->endpoints[i].trans_bts);
    }

    return 0;
}