From b71627b1f74f8c7368fd132f7eec3b2dc26d165f Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Sun, 19 Aug 2012 00:39:21 +0200 Subject: channel: osmo_chan_init takes one pointer to set the talloc context Also remove this parameter from osmo_chan_create --- src/channel.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/channel.c b/src/channel.c index d6e26a8..3b317de 100644 --- a/src/channel.c +++ b/src/channel.c @@ -10,14 +10,17 @@ static LLIST_HEAD(channel_list); extern struct osmo_chan_type chan_abis_ipa_srv; extern struct osmo_chan_type chan_abis_ipa_cli; -void osmo_chan_init(void) +static void *osmo_chan_ctx; + +void osmo_chan_init(void *ctx) { + osmo_chan_ctx = ctx; llist_add(&chan_abis_ipa_srv.head, &channel_list); llist_add(&chan_abis_ipa_cli.head, &channel_list); /* add your new channel type here */ } -struct osmo_chan *osmo_chan_create(void *ctx, int type_id) +struct osmo_chan *osmo_chan_create(int type_id) { struct osmo_chan_type *cur = NULL; int found = 0; @@ -42,7 +45,8 @@ struct osmo_chan *osmo_chan_create(void *ctx, int type_id) return NULL; } - c = talloc_zero_size(ctx, sizeof(struct osmo_chan) + cur->datasiz); + c = talloc_zero_size(osmo_chan_ctx, + sizeof(struct osmo_chan) + cur->datasiz); if (c == NULL) { LOGP(DLINP, LOGL_ERROR, "cannot allocate channel data\n"); return NULL; -- cgit v1.2.3