From patchwork Wed Aug 20 18:15:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harald Welte X-Patchwork-Id: 381767 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ganesha.gnumonks.org (ganesha.gnumonks.org [IPv6:2001:780:45:1d:225:90ff:fe52:c662]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id CDB81140096 for ; Thu, 21 Aug 2014 04:28:31 +1000 (EST) Received: from localhost ([127.0.0.1] helo=ganesha.gnumonks.org) by ganesha.gnumonks.org with esmtp (Exim 4.72) (envelope-from ) id 1XKAcM-0004Ju-Kd; Wed, 20 Aug 2014 20:28:18 +0200 Received: from uucp by ganesha.gnumonks.org with local-bsmtp (Exim 4.72) (envelope-from ) id 1XKARP-0003RH-J5; Wed, 20 Aug 2014 20:16:59 +0200 Received: from laforge by localhost.localdomain with local (Exim 4.84_RC1) (envelope-from ) id 1XKAPl-0002i5-Ck; Wed, 20 Aug 2014 20:15:17 +0200 From: Harald Welte To: openbsc@lists.osmocom.org Subject: [PATCH 3/5] libctrl: Avoid using external tall_bsc_ctx Date: Wed, 20 Aug 2014 20:15:08 +0200 Message-Id: <1408558510-10364-3-git-send-email-laforge@gnumonks.org> X-Mailer: git-send-email 2.1.0.rc1 In-Reply-To: <1408558510-10364-1-git-send-email-laforge@gnumonks.org> References: <1408558510-10364-1-git-send-email-laforge@gnumonks.org> Cc: daniel@totalueberwachung.de, Harald Welte X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Development of the OpenBSC GSM base station controller List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: openbsc-bounces@lists.osmocom.org Errors-To: openbsc-bounces@lists.osmocom.org Instead of using one flat talloc context (and one that is specific to openbsc), we should attach the objects to whatever parent context they are being used in. --- src/ctrl/control_if.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ctrl/control_if.c b/src/ctrl/control_if.c index 7ce8bf6..a208071 100644 --- a/src/ctrl/control_if.c +++ b/src/ctrl/control_if.c @@ -96,7 +96,7 @@ struct ctrl_cmd *ctrl_cmd_trap(struct ctrl_cmd *cmd) { struct ctrl_cmd *trap; - trap = ctrl_cmd_cpy(tall_bsc_ctx, cmd); + trap = ctrl_cmd_cpy(cmd, cmd); if (!trap) return NULL; @@ -281,10 +281,10 @@ static uint64_t get_rate_ctr_value(const struct rate_ctr *ctr, int intv) } } -static char *get_all_rate_ctr_in_group(const struct rate_ctr_group *ctrg, int intv) +static char *get_all_rate_ctr_in_group(void *ctx, const struct rate_ctr_group *ctrg, int intv) { int i; - char *counters = talloc_strdup(tall_bsc_ctx, ""); + char *counters = talloc_strdup(ctx, ""); if (!counters) return NULL; @@ -314,7 +314,7 @@ static int get_rate_ctr_group(const char *ctr_group, int intv, struct ctrl_cmd * if (!ctrg) break; - counters = get_all_rate_ctr_in_group(ctrg, intv); + counters = get_all_rate_ctr_in_group(cmd, ctrg, intv); if (!counters) goto oom; @@ -340,7 +340,7 @@ static int get_rate_ctr_group_idx(const struct rate_ctr_group *ctrg, int intv, s { char *counters; - counters = get_all_rate_ctr_in_group(ctrg, intv); + counters = get_all_rate_ctr_in_group(cmd, ctrg, intv); if (!counters) goto oom; @@ -527,7 +527,7 @@ struct ctrl_handle *controlif_setup(struct gsm_network *gsmnet, uint16_t port, int ret; struct ctrl_handle *ctrl; - ctrl = talloc_zero(tall_bsc_ctx, struct ctrl_handle); + ctrl = talloc_zero(gsmnet, struct ctrl_handle); if (!ctrl) return NULL;