aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libcommon/gsm_data_shared.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2015-12-05 16:19:21 +0100
committerHarald Welte <laforge@gnumonks.org>2015-12-05 16:19:21 +0100
commitc696cc28d8e61a50717e3c2e68a7cfe2d08c8a48 (patch)
tree48720cfb718b652a14f2717364c010502f9bb530 /openbsc/src/libcommon/gsm_data_shared.c
parente1ba781f7b3d45b3e8f9ea87c3041e6980dcf946 (diff)
gsm_data_shared: compute/sprintf the lchan name only once
We now store the pre-printed lchan name in lchan->name to avoid having to call sprintf every time there is a debug statement somewhere, particularly as most of those debug statements are going to be inactive most of the time.
Diffstat (limited to 'openbsc/src/libcommon/gsm_data_shared.c')
-rw-r--r--openbsc/src/libcommon/gsm_data_shared.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c
index 89d13fd83..9f9eb1eeb 100644
--- a/openbsc/src/libcommon/gsm_data_shared.c
+++ b/openbsc/src/libcommon/gsm_data_shared.c
@@ -188,12 +188,15 @@ struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts)
for (l = 0; l < TS_MAX_LCHAN; l++) {
struct gsm_lchan *lchan;
+ char *name;
lchan = &ts->lchan[l];
lchan->ts = ts;
lchan->nr = l;
lchan->type = GSM_LCHAN_NONE;
+ name = gsm_lchan_name_compute(lchan);
+ lchan->name = talloc_strdup(trx, name);
#ifndef ROLE_BSC
INIT_LLIST_HEAD(&lchan->sapi_cmds);
#endif
@@ -345,7 +348,7 @@ char *gsm_ts_name(const struct gsm_bts_trx_ts *ts)
return ts2str;
}
-char *gsm_lchan_name(const struct gsm_lchan *lchan)
+char *gsm_lchan_name_compute(const struct gsm_lchan *lchan)
{
struct gsm_bts_trx_ts *ts = lchan->ts;