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.
This commit is contained in:
Holger Hans Peter Freyther 2013-09-15 17:23:34 +02:00
parent 779a72819d
commit cd40fb4dea
1 changed files with 16 additions and 8 deletions

View File

@ -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)