Change in osmo-e1d[master]: change list ordering for list of interfaces / lines

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Mon Jun 29 15:19:54 UTC 2020


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1d/+/19054 )


Change subject: change list ordering for list of interfaces / lines
......................................................................

change list ordering for list of interfaces / lines

By using llist_add_tail(), we add new elements at the end of the list,
rather than inserting at front.  Among other things, this has the added
benefit that when the VTY prints information on lines, they are printed
in numerically ascending orrder (0,1,2, ...) and not the reverse.

Change-Id: I07a6ba706f855a29b4e33b1a6b008e0d2f11b6f3
---
M src/intf_line.c
1 file changed, 4 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/54/19054/1

diff --git a/src/intf_line.c b/src/intf_line.c
index bc01559..c3466e0 100644
--- a/src/intf_line.c
+++ b/src/intf_line.c
@@ -54,11 +54,11 @@
 	INIT_LLIST_HEAD(&intf->lines);
 
 	if (!llist_empty(&e1d->interfaces)) {
-		struct e1_intf *f = llist_first_entry(&e1d->interfaces, struct e1_intf, list);
+		struct e1_intf *f = llist_last_entry(&e1d->interfaces, struct e1_intf, list);
 		intf->id = f->id + 1;
 	}
 
-	llist_add(&intf->list, &e1d->interfaces);
+	llist_add_tail(&intf->list, &e1d->interfaces);
 
 	return intf;
 }
@@ -80,11 +80,11 @@
 	INIT_LLIST_HEAD(&line->list);
 
 	if (!llist_empty(&intf->lines)) {
-		struct e1_line *l = llist_first_entry(&intf->lines, struct e1_line, list);
+		struct e1_line *l = llist_last_entry(&intf->lines, struct e1_line, list);
 		line->id = l->id + 1;
 	}
 
-	llist_add(&line->list, &intf->lines);
+	llist_add_tail(&line->list, &intf->lines);
 
 	return line;
 }

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/19054
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: I07a6ba706f855a29b4e33b1a6b008e0d2f11b6f3
Gerrit-Change-Number: 19054
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200629/2a288762/attachment.htm>


More information about the gerrit-log mailing list