From cd40fb4dea46cc82acf94f1e671aba2f3f5997cf Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sun, 15 Sep 2013 17:23:34 +0200 Subject: vty: Cosmetic change to the writing of the bts->model Based on the feedback of Peter from the mailinglist, move the writing code to a new method and return early if there is no bts->model. --- openbsc/src/libbsc/bsc_vty.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'openbsc/src/libbsc/bsc_vty.c') diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index 3fb8516ab..2cbcf44c8 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -460,9 +460,23 @@ static void config_write_bts_gprs(struct vty *vty, struct gsm_bts *bts) } } -static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts) +/* Write the model data if there is one */ +static void config_write_bts_model(struct vty *vty, struct gsm_bts *bts) { struct gsm_bts_trx *trx; + + if (!bts->model) + return; + + if (bts->model->config_write_bts) + bts->model->config_write_bts(vty, bts); + + llist_for_each_entry(trx, &bts->trx_list, list) + config_write_trx_single(vty, trx); +} + +static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts) +{ int i; vty_out(vty, " bts %u%s", bts->nr, VTY_NEWLINE); @@ -602,13 +616,7 @@ static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts) if (bts->excl_from_rf_lock) vty_out(vty, " rf-lock-exclude%s", VTY_NEWLINE); - if (bts->model) { - if (bts->model->config_write_bts) - bts->model->config_write_bts(vty, bts); - - llist_for_each_entry(trx, &bts->trx_list, list) - config_write_trx_single(vty, trx); - } + config_write_bts_model(vty, bts); } static int config_write_bts(struct vty *v) -- cgit v1.2.3