pespin has uploaded this change for review.

View Change

osmux: Use while loop to tear down entire llist

There's no need to use more complex llist_for_each_entry_safe() here.

Related: SYS#7508
Change-Id: Id98619b1e91f12b0febf40118113bb53bd526702
---
M src/osmux_input.c
1 file changed, 4 insertions(+), 4 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/28/40628/1
diff --git a/src/osmux_input.c b/src/osmux_input.c
index 2184a08..41f12b6 100644
--- a/src/osmux_input.c
+++ b/src/osmux_input.c
@@ -144,8 +144,8 @@

static void osmux_circuit_del_msgs(struct osmux_link *link, struct osmux_circuit *circuit)
{
- struct msgb *cur, *tmp;
- llist_for_each_entry_safe(cur, tmp, &circuit->msg_list, list) {
+ struct msgb *cur;
+ while ((cur = llist_first_entry_or_null(&circuit->msg_list, struct msgb, list))) {
osmux_circuit_dequeue(circuit, cur);
msgb_free(cur);
link->nmsgs--;
@@ -687,9 +687,9 @@
static int osmux_xfrm_input_talloc_destructor(struct osmux_in_handle *h)
{
struct osmux_link *link = (struct osmux_link *)h->internal_data;
- struct osmux_circuit *circuit, *next;
+ struct osmux_circuit *circuit;

- llist_for_each_entry_safe(circuit, next, &link->circuit_list, head)
+ while ((circuit = llist_first_entry_or_null(&link->circuit_list, struct osmux_circuit, head)))
osmux_link_del_circuit(link, circuit);

osmo_timer_del(&link->timer);

To view, visit change 40628. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Id98619b1e91f12b0febf40118113bb53bd526702
Gerrit-Change-Number: 40628
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin@sysmocom.de>