On 03/05/11 23:14, Holger Hans Peter Freyther wrote:
> On 05/03/2011 10:44 PM, [email protected] wrote:
> 
>> -    vty_out(vty, "e1_input%s", VTY_NEWLINE);
>> +    bool heading = false;
> 
> what about
> 
>       if (llist_empty(&e1in..)
>               return;

Please, find it attached the new patch with your suggestion.
abis: skip e1_input nesting if empty

From: Pablo Neira Ayuso <[email protected]>

With this patch, we don't include e1_input if it's empty

[...]
    timeslot 7
     phys_chan_config TCH/F
     hopping enabled 0
e1_input <----------------- empty, it should not show up.
msc
[...]

Use of llist_empty(...) in this patch suggested by Zecke.

---
 openbsc/src/libabis/e1_input_vty.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/openbsc/src/libabis/e1_input_vty.c b/openbsc/src/libabis/e1_input_vty.c
index 7dbf17a..b211e81 100644
--- a/openbsc/src/libabis/e1_input_vty.c
+++ b/openbsc/src/libabis/e1_input_vty.c
@@ -76,6 +76,9 @@ static int e1inp_config_write(struct vty *vty)
 {
 	struct e1inp_line *line;
 
+	if (llist_empty(&e1inp_line_list))
+		return CMD_SUCCESS;
+
 	vty_out(vty, "e1_input%s", VTY_NEWLINE);
 
 	llist_for_each_entry(line, &e1inp_line_list, list) {

Reply via email to