From 9e56549c2bba79e644de2d3876b363553175210c Mon Sep 17 00:00:00 2001 From: Adrian Moreno Date: Wed, 23 Mar 2022 12:56:17 +0100 Subject: hmap: use short version of safe loops if possible. Using SHORT version of the *_SAFE loops makes the code cleaner and less error prone. So, use the SHORT version and remove the extra variable when possible for hmap and all its derived types. In order to be able to use both long and short versions without changing the name of the macro for all the clients, overload the existing name and select the appropriate version depending on the number of arguments. Acked-by: Dumitru Ceara Acked-by: Eelco Chaudron Signed-off-by: Adrian Moreno Signed-off-by: Ilya Maximets --- lib/mac-learning.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/mac-learning.c') diff --git a/lib/mac-learning.c b/lib/mac-learning.c index 3fcd7d9b7..a60794fb2 100644 --- a/lib/mac-learning.c +++ b/lib/mac-learning.c @@ -244,10 +244,10 @@ void mac_learning_unref(struct mac_learning *ml) { if (ml && ovs_refcount_unref(&ml->ref_cnt) == 1) { - struct mac_entry *e, *next; + struct mac_entry *e; ovs_rwlock_wrlock(&ml->rwlock); - HMAP_FOR_EACH_SAFE (e, next, hmap_node, &ml->table) { + HMAP_FOR_EACH_SAFE (e, hmap_node, &ml->table) { mac_learning_expire(ml, e); } hmap_destroy(&ml->table); -- cgit v1.2.1