From b500040ab250e7e93a3c152715e2d84d7d60edb2 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 31 Mar 2008 13:46:39 -0700 Subject: [PATCH] Use LIST_FOR_EACH_SAFE, not LIST_FOR_EACH, when deleting from a list. --- switch/table-mac.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/switch/table-mac.c b/switch/table-mac.c index cfcd72fa..6686477e 100644 --- a/switch/table-mac.c +++ b/switch/table-mac.c @@ -126,8 +126,8 @@ static int table_mac_delete(struct sw_table *swt, int count = 0; for (i = 0; i <= tm->bucket_mask; i++) { struct list *bucket = &tm->buckets[i]; - struct sw_flow *flow; - LIST_FOR_EACH (flow, struct sw_flow, node, bucket) { + struct sw_flow *flow, *next; + LIST_FOR_EACH_SAFE (flow, next, struct sw_flow, node, bucket) { if (flow_del_matches(&flow->key, key, strict)) { do_delete(flow); count++; @@ -147,8 +147,8 @@ static int table_mac_timeout(struct datapath *dp, struct sw_table *swt) for (i = 0; i <= tm->bucket_mask; i++) { struct list *bucket = &tm->buckets[i]; - struct sw_flow *flow; - LIST_FOR_EACH (flow, struct sw_flow, node, bucket) { + struct sw_flow *flow, *next; + LIST_FOR_EACH_SAFE (flow, next, struct sw_flow, node, bucket) { if (flow_timeout(flow)) { dp_send_flow_expired(dp, flow); do_delete(flow); -- 2.30.2