From: Ben Pfaff <blp@nicira.com>
Date: Mon, 31 Mar 2008 20:46:39 +0000 (-0700)
Subject: Use LIST_FOR_EACH_SAFE, not LIST_FOR_EACH, when deleting from a list.
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=b500040ab250e7e93a3c152715e2d84d7d60edb2;p=sliver-openvswitch.git

Use LIST_FOR_EACH_SAFE, not LIST_FOR_EACH, when deleting from a list.
---

diff --git a/switch/table-mac.c b/switch/table-mac.c
index cfcd72fa1..6686477ea 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);