On 9 Mar 2022, at 17:10, Adrian Moreno wrote:

> Using the 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.
>
> 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 <dce...@redhat.com>
> Signed-off-by: Adrian Moreno <amore...@redhat.com>

Other than some small nits below, the patch looks good to me.


Acked-by: Eelco Chaudron <echau...@redhat.com>

> ---
>  include/openvswitch/list.h   | 30 ++++++++++++++++++++++++++++--
>  lib/conntrack.c              |  4 ++--
>  lib/fat-rwlock.c             |  4 ++--
>  lib/id-fpool.c               |  3 +--
>  lib/ipf.c                    | 22 +++++++++++-----------
>  lib/lldp/lldpd-structs.c     |  7 +++----
>  lib/lldp/lldpd.c             |  8 ++++----
>  lib/mcast-snooping.c         | 12 ++++++------
>  lib/netdev-afxdp.c           |  4 ++--
>  lib/netdev-dpdk.c            |  4 ++--
>  lib/ofp-msgs.c               |  4 ++--
>  lib/ovs-lldp.c               | 12 ++++++------
>  lib/ovsdb-idl.c              | 30 +++++++++++++++---------------
>  lib/seq.c                    |  4 ++--
>  lib/tnl-ports.c              | 16 ++++++++--------
>  lib/unixctl.c                |  8 ++++----
>  lib/vconn.c                  |  4 ++--
>  ofproto/connmgr.c            |  8 ++++----
>  ofproto/ofproto-dpif-ipfix.c |  4 ++--
>  ofproto/ofproto-dpif-trace.c |  4 ++--
>  ofproto/ofproto-dpif-xlate.c |  4 ++--
>  ofproto/ofproto-dpif.c       | 24 +++++++++++-------------
>  ovsdb/jsonrpc-server.c       | 16 ++++++++--------
>  ovsdb/monitor.c              | 24 ++++++++++++------------
>  ovsdb/ovsdb.c                |  4 ++--
>  ovsdb/raft.c                 | 15 +++++++--------
>  ovsdb/transaction-forward.c  |  6 +++---
>  ovsdb/transaction.c          | 28 ++++++++++++++--------------
>  ovsdb/trigger.c              |  4 ++--
>  tests/test-list.c            | 29 +++++++++++++++++++++++++++++
>  utilities/ovs-ofctl.c        |  4 ++--
>  utilities/ovs-vsctl.c        |  8 ++++----
>  vswitchd/bridge.c            | 16 ++++++++--------
>  vtep/vtep-ctl.c              | 12 ++++++------
>  34 files changed, 218 insertions(+), 168 deletions(-)
>
> diff --git a/include/openvswitch/list.h b/include/openvswitch/list.h
> index bbd2edbd0..6a7d4b2ff 100644
> --- a/include/openvswitch/list.h
> +++ b/include/openvswitch/list.h
> @@ -92,7 +92,8 @@ static inline bool ovs_list_is_short(const struct ovs_list 
> *);
>           CONDITION_MULTIVAR(VAR, MEMBER, ITER_VAR(VAR) != (LIST));           
>  \
>           UPDATE_MULTIVAR(VAR, ITER_VAR(VAR)->prev))
>
> -#define LIST_FOR_EACH_REVERSE_SAFE(VAR, PREV, MEMBER, LIST)                  
>  \
> +/* LONG version of SAFE iterators */

Ending sentence with a dot.

> +#define LIST_FOR_EACH_REVERSE_SAFE_LONG(VAR, PREV, MEMBER, LIST)             
>  \
>      for (INIT_MULTIVAR_SAFE_LONG(VAR, PREV, MEMBER, (LIST)->prev,            
>  \
>                                   struct ovs_list);                           
>  \
>           CONDITION_MULTIVAR_SAFE_LONG(VAR, PREV, MEMBER,                     
>  \
> @@ -101,7 +102,7 @@ static inline bool ovs_list_is_short(const struct 
> ovs_list *);
>                                        ITER_VAR(PREV) != (LIST));             
>  \
>           UPDATE_MULTIVAR_SAFE_LONG(VAR, PREV))
>
> -#define LIST_FOR_EACH_SAFE(VAR, NEXT, MEMBER, LIST)                          
>  \
> +#define LIST_FOR_EACH_SAFE_LONG(VAR, NEXT, MEMBER, LIST)                     
>  \
>      for (INIT_MULTIVAR_SAFE_LONG(VAR, NEXT, MEMBER, (LIST)->next,            
>  \
>                                   struct ovs_list);                           
>  \
>           CONDITION_MULTIVAR_SAFE_LONG(VAR, NEXT, MEMBER,                     
>  \
> @@ -110,6 +111,31 @@ static inline bool ovs_list_is_short(const struct 
> ovs_list *);
>                                        ITER_VAR(NEXT) != (LIST));             
>  \
>           UPDATE_MULTIVAR_SAFE_LONG(VAR, NEXT))

Do we really want to keep this MACRO as it’s not being used anywhere?

> +/* SHORT version of SAFE iterators */

Ending sentence with a dot.

> +#define LIST_FOR_EACH_REVERSE_SAFE_SHORT(VAR, MEMBER, LIST)                  
>  \
> +    for (INIT_MULTIVAR_SAFE_SHORT(VAR, MEMBER, (LIST)->prev, struct 
> ovs_list);\
> +         CONDITION_MULTIVAR_SAFE_SHORT(VAR, MEMBER,                          
>  \
> +                                       ITER_VAR(VAR) != (LIST),              
>  \
> +                                 ITER_NEXT_VAR(VAR) = ITER_VAR(VAR)->prev);  
>  \
> +         UPDATE_MULTIVAR_SAFE_SHORT(VAR))
> +
> +#define LIST_FOR_EACH_SAFE_SHORT(VAR, MEMBER, LIST)                          
>  \
> +    for (INIT_MULTIVAR_SAFE_SHORT(VAR, MEMBER, (LIST)->next, struct 
> ovs_list);\
> +         CONDITION_MULTIVAR_SAFE_SHORT(VAR, MEMBER,                          
>  \
> +                                       ITER_VAR(VAR) != (LIST),              
>  \
> +                                 ITER_NEXT_VAR(VAR) = ITER_VAR(VAR)->next);  
>  \
> +         UPDATE_MULTIVAR_SAFE_SHORT(VAR))
> +
> +#define LIST_FOR_EACH_SAFE(...)                      \
> +    OVERLOAD_SAFE_MACRO(LIST_FOR_EACH_SAFE_LONG,     \
> +                        LIST_FOR_EACH_SAFE_SHORT,    \
> +                        4, __VA_ARGS__)
> +
> +#define LIST_FOR_EACH_REVERSE_SAFE(...)                        \
> +    OVERLOAD_SAFE_MACRO(LIST_FOR_EACH_REVERSE_SAFE_LONG,       \
> +                        LIST_FOR_EACH_REVERSE_SAFE_SHORT,      \
> +                        4, __VA_ARGS__)
> +
>  #define LIST_FOR_EACH_POP(ITER, MEMBER, LIST)                                
>  \
>      while (!ovs_list_is_empty(LIST) ?                                        
>  \
>             (INIT_CONTAINER(ITER, ovs_list_pop_front(LIST), MEMBER), 1) :     
>  \
> diff --git a/lib/conntrack.c b/lib/conntrack.c
> index 40690e5f0..4e2eb2932 100644
> --- a/lib/conntrack.c
> +++ b/lib/conntrack.c
> @@ -1526,14 +1526,14 @@ set_label(struct dp_packet *pkt, struct conn *conn,
>  static long long
>  ct_sweep(struct conntrack *ct, long long now, size_t limit)
>  {
> -    struct conn *conn, *next;
> +    struct conn *conn;
>      long long min_expiration = LLONG_MAX;
>      size_t count = 0;
>
>      ovs_mutex_lock(&ct->ct_lock);
>
>      for (unsigned i = 0; i < N_CT_TM; i++) {
> -        LIST_FOR_EACH_SAFE (conn, next, exp_node, &ct->exp_lists[i]) {
> +        LIST_FOR_EACH_SAFE (conn, exp_node, &ct->exp_lists[i]) {
>              ovs_mutex_lock(&conn->lock);
>              if (now < conn->expiration || count >= limit) {
>                  min_expiration = MIN(min_expiration, conn->expiration);
> diff --git a/lib/fat-rwlock.c b/lib/fat-rwlock.c
> index d913b2088..771ccc973 100644
> --- a/lib/fat-rwlock.c
> +++ b/lib/fat-rwlock.c
> @@ -97,14 +97,14 @@ fat_rwlock_init(struct fat_rwlock *rwlock)
>  void
>  fat_rwlock_destroy(struct fat_rwlock *rwlock)
>  {
> -    struct fat_rwlock_slot *slot, *next;
> +    struct fat_rwlock_slot *slot;
>
>      /* Order is important here.  By destroying the thread-specific data 
> first,
>       * before we destroy the slots, we ensure that the thread-specific
>       * data destructor can't race with our loop below. */
>      ovsthread_key_delete(rwlock->key);
>
> -    LIST_FOR_EACH_SAFE (slot, next, list_node, &rwlock->threads) {
> +    LIST_FOR_EACH_SAFE (slot, list_node, &rwlock->threads) {
>          free_slot(slot);
>      }
>      ovs_mutex_destroy(&rwlock->mutex);
> diff --git a/lib/id-fpool.c b/lib/id-fpool.c
> index 15cef5d00..7108c104a 100644
> --- a/lib/id-fpool.c
> +++ b/lib/id-fpool.c
> @@ -166,11 +166,10 @@ void
>  id_fpool_destroy(struct id_fpool *pool)
>  {
>      struct id_slab *slab;
> -    struct id_slab *next;
>      size_t i;
>
>      id_fpool_lock(&pool->pool_lock);
> -    LIST_FOR_EACH_SAFE (slab, next, node, &pool->free_slabs) {
> +    LIST_FOR_EACH_SAFE (slab, node, &pool->free_slabs) {
>          free(slab);
>      }
>      ovs_list_poison(&pool->free_slabs);
> diff --git a/lib/ipf.c b/lib/ipf.c
> index 507db2aea..d45266374 100644
> --- a/lib/ipf.c
> +++ b/lib/ipf.c
> @@ -1058,9 +1058,9 @@ ipf_send_completed_frags(struct ipf *ipf, struct 
> dp_packet_batch *pb,
>      }
>
>      ovs_mutex_lock(&ipf->ipf_lock);
> -    struct ipf_list *ipf_list, *next;
> +    struct ipf_list *ipf_list;
>
> -    LIST_FOR_EACH_SAFE (ipf_list, next, list_node, &ipf->frag_complete_list) 
> {
> +    LIST_FOR_EACH_SAFE (ipf_list, list_node, &ipf->frag_complete_list) {
>          if (ipf_send_frags_in_list(ipf, ipf_list, pb, 
> IPF_FRAG_COMPLETED_LIST,
>                                     v6, now)) {
>              ipf_completed_list_clean(&ipf->frag_lists, ipf_list);
> @@ -1090,10 +1090,10 @@ ipf_send_expired_frags(struct ipf *ipf, struct 
> dp_packet_batch *pb,
>      }
>
>      ovs_mutex_lock(&ipf->ipf_lock);
> -    struct ipf_list *ipf_list, *next;
> +    struct ipf_list *ipf_list;
>      size_t lists_removed = 0;
>
> -    LIST_FOR_EACH_SAFE (ipf_list, next, list_node, &ipf->frag_exp_list) {
> +    LIST_FOR_EACH_SAFE (ipf_list, list_node, &ipf->frag_exp_list) {
>          if (now <= ipf_list->expiration ||
>              lists_removed >= IPF_FRAG_LIST_MAX_EXPIRED) {
>              break;
> @@ -1121,9 +1121,9 @@ ipf_execute_reass_pkts(struct ipf *ipf, struct 
> dp_packet_batch *pb)
>      }
>
>      ovs_mutex_lock(&ipf->ipf_lock);
> -    struct reassembled_pkt *rp, *next;
> +    struct reassembled_pkt *rp;
>
> -    LIST_FOR_EACH_SAFE (rp, next, rp_list_node, &ipf->reassembled_pkt_list) {
> +    LIST_FOR_EACH_SAFE (rp, rp_list_node, &ipf->reassembled_pkt_list) {
>          if (!rp->list->reass_execute_ctx &&
>              ipf_dp_packet_batch_add(pb, rp->pkt, false)) {
>              rp->list->reass_execute_ctx = rp->pkt;
> @@ -1144,9 +1144,9 @@ ipf_post_execute_reass_pkts(struct ipf *ipf,
>      }
>
>      ovs_mutex_lock(&ipf->ipf_lock);
> -    struct reassembled_pkt *rp, *next;
> +    struct reassembled_pkt *rp;
>
> -    LIST_FOR_EACH_SAFE (rp, next, rp_list_node, &ipf->reassembled_pkt_list) {
> +    LIST_FOR_EACH_SAFE (rp, rp_list_node, &ipf->reassembled_pkt_list) {
>          const size_t pb_cnt = dp_packet_batch_size(pb);
>          int pb_idx;
>          struct dp_packet *pkt;
> @@ -1271,15 +1271,15 @@ ipf_clean_thread_main(void *f)
>
>              ovs_mutex_lock(&ipf->ipf_lock);
>
> -            struct ipf_list *ipf_list, *next;
> -            LIST_FOR_EACH_SAFE (ipf_list, next, list_node,
> +            struct ipf_list *ipf_list;
> +            LIST_FOR_EACH_SAFE (ipf_list, list_node,
>                                  &ipf->frag_exp_list) {
>                  if (ipf_purge_list_check(ipf, ipf_list, now)) {
>                      ipf_expiry_list_clean(&ipf->frag_lists, ipf_list);
>                  }
>              }
>
> -            LIST_FOR_EACH_SAFE (ipf_list, next, list_node,
> +            LIST_FOR_EACH_SAFE (ipf_list, list_node,
>                                  &ipf->frag_complete_list) {
>                  if (ipf_purge_list_check(ipf, ipf_list, now)) {
>                      ipf_completed_list_clean(&ipf->frag_lists, ipf_list);
> diff --git a/lib/lldp/lldpd-structs.c b/lib/lldp/lldpd-structs.c
> index 499b44174..a8c7fad09 100644
> --- a/lib/lldp/lldpd-structs.c
> +++ b/lib/lldp/lldpd-structs.c
> @@ -64,11 +64,11 @@ lldpd_remote_cleanup(struct lldpd_hardware *hw,
>                                     struct lldpd_port *),
>                       bool all)
>  {
> -    struct lldpd_port *port, *port_next;
> +    struct lldpd_port *port;
>      time_t now = time_now();
>
>      VLOG_DBG("cleanup remote port on %s", hw->h_ifname);
> -    LIST_FOR_EACH_SAFE (port, port_next, p_entries, &hw->h_rports) {
> +    LIST_FOR_EACH_SAFE (port, p_entries, &hw->h_rports) {
>          bool del = all;
>          if (!all && expire &&
>              (now >= port->p_lastupdate + port->p_chassis->c_ttl)) {
> @@ -99,11 +99,10 @@ static void
>  lldpd_aa_maps_cleanup(struct lldpd_port *port)
>  {
>      struct lldpd_aa_isid_vlan_maps_tlv *isid_vlan_map = NULL;
> -    struct lldpd_aa_isid_vlan_maps_tlv *isid_vlan_map_next = NULL;
>
>      if (!ovs_list_is_empty(&port->p_isid_vlan_maps)) {
>
> -        LIST_FOR_EACH_SAFE (isid_vlan_map, isid_vlan_map_next, m_entries,
> +        LIST_FOR_EACH_SAFE (isid_vlan_map, m_entries,
>                              &port->p_isid_vlan_maps) {
>
>              ovs_list_remove(&isid_vlan_map->m_entries);
> diff --git a/lib/lldp/lldpd.c b/lib/lldp/lldpd.c
> index a024dc5e5..403f1f525 100644
> --- a/lib/lldp/lldpd.c
> +++ b/lib/lldp/lldpd.c
> @@ -134,12 +134,12 @@ lldpd_hardware_cleanup(struct lldpd *cfg, struct 
> lldpd_hardware *hardware)
>  void
>  lldpd_cleanup(struct lldpd *cfg)
>  {
> -    struct lldpd_hardware *hw, *hw_next;
> -    struct lldpd_chassis *chassis, *chassis_next;
> +    struct lldpd_hardware *hw;
> +    struct lldpd_chassis *chassis;
>
>      VLOG_DBG("cleanup all ports");
>
> -    LIST_FOR_EACH_SAFE (hw, hw_next, h_entries, &cfg->g_hardware) {
> +    LIST_FOR_EACH_SAFE (hw, h_entries, &cfg->g_hardware) {
>          if (!hw->h_flags) {
>              ovs_list_remove(&hw->h_entries);
>              lldpd_remote_cleanup(hw, NULL, true);
> @@ -151,7 +151,7 @@ lldpd_cleanup(struct lldpd *cfg)
>
>      VLOG_DBG("cleanup all chassis");
>
> -    LIST_FOR_EACH_SAFE (chassis, chassis_next, list, &cfg->g_chassis) {
> +    LIST_FOR_EACH_SAFE (chassis, list, &cfg->g_chassis) {
>          if (chassis->c_refcount == 0) {
>              ovs_list_remove(&chassis->list);
>              lldpd_chassis_cleanup(chassis, 1);
> diff --git a/lib/mcast-snooping.c b/lib/mcast-snooping.c
> index 6730301b6..029ca2855 100644
> --- a/lib/mcast-snooping.c
> +++ b/lib/mcast-snooping.c
> @@ -356,11 +356,11 @@ mcast_snooping_prune_expired(struct mcast_snooping *ms,
>      OVS_REQ_WRLOCK(ms->rwlock)
>  {
>      int expired;
> -    struct mcast_group_bundle *b, *next_b;
> +    struct mcast_group_bundle *b;
>      time_t timenow = time_now();
>
>      expired = 0;
> -    LIST_FOR_EACH_SAFE (b, next_b, bundle_node, &grp->bundle_lru) {
> +    LIST_FOR_EACH_SAFE (b, bundle_node, &grp->bundle_lru) {
>          /* This list is sorted on expiration time. */
>          if (b->expires > timenow) {
>              break;
> @@ -946,15 +946,15 @@ mcast_snooping_wait(struct mcast_snooping *ms)
>  void
>  mcast_snooping_flush_bundle(struct mcast_snooping *ms, void *port)
>  {
> -    struct mcast_group *g, *next_g;
> -    struct mcast_mrouter_bundle *m, *next_m;
> +    struct mcast_group *g;
> +    struct mcast_mrouter_bundle *m;
>
>      if (!mcast_snooping_enabled(ms)) {
>          return;
>      }
>
>      ovs_rwlock_wrlock(&ms->rwlock);
> -    LIST_FOR_EACH_SAFE (g, next_g, group_node, &ms->group_lru) {
> +    LIST_FOR_EACH_SAFE (g, group_node, &ms->group_lru) {
>          if (mcast_group_delete_bundle(ms, g, port)) {
>              ms->need_revalidate = true;
>
> @@ -964,7 +964,7 @@ mcast_snooping_flush_bundle(struct mcast_snooping *ms, 
> void *port)
>          }
>      }
>
> -    LIST_FOR_EACH_SAFE (m, next_m, mrouter_node, &ms->mrouter_lru) {
> +    LIST_FOR_EACH_SAFE (m, mrouter_node, &ms->mrouter_lru) {
>          if (m->port == port) {
>              mcast_snooping_flush_mrouter(m);
>              ms->need_revalidate = true;
> diff --git a/lib/netdev-afxdp.c b/lib/netdev-afxdp.c
> index 482400d8d..ca3f2431e 100644
> --- a/lib/netdev-afxdp.c
> +++ b/lib/netdev-afxdp.c
> @@ -235,11 +235,11 @@ netdev_afxdp_cleanup_unused_pool(struct unused_pool 
> *pool)
>  static void
>  netdev_afxdp_sweep_unused_pools(void *aux OVS_UNUSED)
>  {
> -    struct unused_pool *pool, *next;
> +    struct unused_pool *pool;
>      unsigned int count;
>
>      ovs_mutex_lock(&unused_pools_mutex);
> -    LIST_FOR_EACH_SAFE (pool, next, list_node, &unused_pools) {
> +    LIST_FOR_EACH_SAFE (pool, list_node, &unused_pools) {
>
>          count = umem_pool_count(&pool->umem_info->mpool);
>          ovs_assert(count + pool->lost_in_rings <= NUM_FRAMES);
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> index fbc3b42d8..2dd95a4cc 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -623,9 +623,9 @@ dpdk_mp_full(const struct rte_mempool *mp) 
> OVS_REQUIRES(dpdk_mp_mutex)
>  static void
>  dpdk_mp_sweep(void) OVS_REQUIRES(dpdk_mp_mutex)
>  {
> -    struct dpdk_mp *dmp, *next;
> +    struct dpdk_mp *dmp;
>
> -    LIST_FOR_EACH_SAFE (dmp, next, list_node, &dpdk_mp_list) {
> +    LIST_FOR_EACH_SAFE (dmp, list_node, &dpdk_mp_list) {
>          if (!dmp->refcount && dpdk_mp_full(dmp->mp)) {
>              VLOG_DBG("Freeing mempool \"%s\"", dmp->mp->name);
>              ovs_list_remove(&dmp->list_node);
> diff --git a/lib/ofp-msgs.c b/lib/ofp-msgs.c
> index fec54f75f..8f969ee59 100644
> --- a/lib/ofp-msgs.c
> +++ b/lib/ofp-msgs.c
> @@ -1290,8 +1290,8 @@ ofpmp_assembler_execute(struct hmap *assembler, struct 
> ofpbuf *msg,
>       * on either side by parts with 0-byte bodies.  We remove the 0-byte
>       * ones here to simplify processing later.
>       */
> -    struct ofpbuf *b, *next;
> -    LIST_FOR_EACH_SAFE (b, next, list_node, out) {
> +    struct ofpbuf *b;
> +    LIST_FOR_EACH_SAFE (b, list_node, out) {
>          if (b->size <= min_len && !ovs_list_is_short(out)) {
>              ovs_list_remove(&b->list_node);
>              ofpbuf_delete(b);
> diff --git a/lib/ovs-lldp.c b/lib/ovs-lldp.c
> index 162311fa4..a9d205ec8 100644
> --- a/lib/ovs-lldp.c
> +++ b/lib/ovs-lldp.c
> @@ -559,9 +559,9 @@ aa_mapping_unregister_mapping(struct lldp *lldp,
>                                struct lldpd_hardware *hw,
>                                struct aa_mapping_internal *m)
>  {
> -    struct lldpd_aa_isid_vlan_maps_tlv *lm, *lm_next;
> +    struct lldpd_aa_isid_vlan_maps_tlv *lm;
>
> -    LIST_FOR_EACH_SAFE (lm, lm_next, m_entries,
> +    LIST_FOR_EACH_SAFE (lm, m_entries,
>                          &hw->h_lport.p_isid_vlan_maps) {
>          uint32_t isid = lm->isid_vlan_data.isid;
>
> @@ -953,8 +953,8 @@ lldp_ref(const struct lldp *lldp_)
>  void
>  lldp_destroy_dummy(struct lldp *lldp)
>  {
> -    struct lldpd_hardware *hw, *hw_next;
> -    struct lldpd_chassis *chassis, *chassis_next;
> +    struct lldpd_hardware *hw;
> +    struct lldpd_chassis *chassis;
>      struct lldpd *cfg;
>
>      if (!lldp) {
> @@ -963,13 +963,13 @@ lldp_destroy_dummy(struct lldp *lldp)
>
>      cfg = lldp->lldpd;
>
> -    LIST_FOR_EACH_SAFE (hw, hw_next, h_entries, &cfg->g_hardware) {
> +    LIST_FOR_EACH_SAFE (hw, h_entries, &cfg->g_hardware) {
>          ovs_list_remove(&hw->h_entries);
>          free(hw->h_lport.p_lastframe);
>          free(hw);
>      }
>
> -    LIST_FOR_EACH_SAFE (chassis, chassis_next, list, &cfg->g_chassis) {
> +    LIST_FOR_EACH_SAFE (chassis, list, &cfg->g_chassis) {
>          ovs_list_remove(&chassis->list);
>          free(chassis);
>      }
> diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
> index c19128d55..13e086358 100644
> --- a/lib/ovsdb-idl.c
> +++ b/lib/ovsdb-idl.c
> @@ -396,18 +396,18 @@ ovsdb_idl_clear(struct ovsdb_idl *db)
>          }
>
>          HMAP_FOR_EACH_SAFE (row, next_row, hmap_node, &table->rows) {
> -            struct ovsdb_idl_arc *arc, *next_arc;
> +            struct ovsdb_idl_arc *arc;
>
>              if (!ovsdb_idl_row_is_orphan(row)) {
>                  ovsdb_idl_remove_from_indexes(row);
>                  ovsdb_idl_row_unparse(row);
>              }
> -            LIST_FOR_EACH_SAFE (arc, next_arc, src_node, &row->src_arcs) {
> +            LIST_FOR_EACH_SAFE (arc, src_node, &row->src_arcs) {
>                  ovs_list_remove(&arc->src_node);
>                  ovs_list_remove(&arc->dst_node);
>                  free(arc);
>              }
> -            LIST_FOR_EACH_SAFE (arc, next_arc, dst_node, &row->dst_arcs) {
> +            LIST_FOR_EACH_SAFE (arc, dst_node, &row->dst_arcs) {
>                  ovs_list_remove(&arc->src_node);
>                  ovs_list_remove(&arc->dst_node);
>                  free(arc);
> @@ -1345,9 +1345,9 @@ ovsdb_idl_track_clear__(struct ovsdb_idl *idl, bool 
> flush_all)
>          struct ovsdb_idl_table *table = &idl->tables[i];
>
>          if (!ovs_list_is_empty(&table->track_list)) {
> -            struct ovsdb_idl_row *row, *next;
> +            struct ovsdb_idl_row *row;
>
> -            LIST_FOR_EACH_SAFE(row, next, track_node, &table->track_list) {
> +            LIST_FOR_EACH_SAFE (row, track_node, &table->track_list) {
>                  if (row->updated) {
>                      free(row->updated);
>                      row->updated = NULL;
> @@ -1480,9 +1480,9 @@ ovsdb_idl_parse_update(struct ovsdb_idl *idl,
>  static void
>  ovsdb_idl_reparse_deleted(struct ovsdb_idl *db)
>  {
> -    struct ovsdb_idl_row *row, *next;
> +    struct ovsdb_idl_row *row;
>
> -    LIST_FOR_EACH_SAFE (row, next, track_node, &db->deleted_untracked_rows) {
> +    LIST_FOR_EACH_SAFE (row, track_node, &db->deleted_untracked_rows) {
>          ovsdb_idl_row_untrack_change(row);
>          add_tracked_change_for_references(row);
>          ovsdb_idl_row_reparse_backrefs(row);
> @@ -1906,8 +1906,8 @@ ovsdb_idl_index_create2(struct ovsdb_idl *idl,
>  static void
>  ovsdb_idl_destroy_indexes(struct ovsdb_idl_table *table)
>  {
> -    struct ovsdb_idl_index *index, *next;
> -    LIST_FOR_EACH_SAFE (index, next, node, &table->indexes) {
> +    struct ovsdb_idl_index *index;
> +    LIST_FOR_EACH_SAFE (index, node, &table->indexes) {
>          skiplist_destroy(index->skiplist, NULL);
>          free(index->columns);
>          free(index);
> @@ -2145,12 +2145,12 @@ ovsdb_idl_row_clear_new(struct ovsdb_idl_row *row)
>  static void
>  ovsdb_idl_row_clear_arcs(struct ovsdb_idl_row *row, bool destroy_dsts)
>  {
> -    struct ovsdb_idl_arc *arc, *next;
> +    struct ovsdb_idl_arc *arc;
>
>      /* Delete all forward arcs.  If 'destroy_dsts', destroy any orphaned rows
>       * that this causes to be unreferenced.
>       */
> -    LIST_FOR_EACH_SAFE (arc, next, src_node, &row->src_arcs) {
> +    LIST_FOR_EACH_SAFE (arc, src_node, &row->src_arcs) {
>          ovs_list_remove(&arc->dst_node);
>          if (destroy_dsts
>              && ovsdb_idl_row_is_orphan(arc->dst)
> @@ -2166,7 +2166,7 @@ ovsdb_idl_row_clear_arcs(struct ovsdb_idl_row *row, 
> bool destroy_dsts)
>  static void
>  ovsdb_idl_row_reparse_backrefs(struct ovsdb_idl_row *row)
>  {
> -    struct ovsdb_idl_arc *arc, *next;
> +    struct ovsdb_idl_arc *arc;
>
>      /* This is trickier than it looks.  ovsdb_idl_row_clear_arcs() will 
> destroy
>       * 'arc', so we need to use the "safe" variant of list traversal.  
> However,
> @@ -2178,7 +2178,7 @@ ovsdb_idl_row_reparse_backrefs(struct ovsdb_idl_row 
> *row)
>       * (If duplicate arcs were possible then we would need to make sure that
>       * 'next' didn't also point into 'arc''s destination, but we forbid
>       * duplicate arcs.) */
> -    LIST_FOR_EACH_SAFE (arc, next, dst_node, &row->dst_arcs) {
> +    LIST_FOR_EACH_SAFE (arc, dst_node, &row->dst_arcs) {
>          struct ovsdb_idl_row *ref = arc->src;
>
>          ovsdb_idl_row_unparse(ref);
> @@ -2329,9 +2329,9 @@ ovsdb_idl_row_destroy_postprocess(struct ovsdb_idl *idl)
>          struct ovsdb_idl_table *table = &idl->tables[i];
>
>          if (!ovs_list_is_empty(&table->track_list)) {
> -            struct ovsdb_idl_row *row, *next;
> +            struct ovsdb_idl_row *row;
>
> -            LIST_FOR_EACH_SAFE(row, next, track_node, &table->track_list) {
> +            LIST_FOR_EACH_SAFE (row, track_node, &table->track_list) {
>                  if (!ovsdb_idl_track_is_set(row->table)) {
>                      ovs_list_remove(&row->track_node);
>                      ovsdb_idl_row_unparse(row);
> diff --git a/lib/seq.c b/lib/seq.c
> index 6581cb06b..2434ccb5d 100644
> --- a/lib/seq.c
> +++ b/lib/seq.c
> @@ -297,9 +297,9 @@ static void
>  seq_thread_woke(struct seq_thread *thread)
>      OVS_REQUIRES(seq_mutex)
>  {
> -    struct seq_waiter *waiter, *next_waiter;
> +    struct seq_waiter *waiter;
>
> -    LIST_FOR_EACH_SAFE (waiter, next_waiter, list_node, &thread->waiters) {
> +    LIST_FOR_EACH_SAFE (waiter, list_node, &thread->waiters) {
>          ovs_assert(waiter->thread == thread);
>          seq_waiter_destroy(waiter);
>      }
> diff --git a/lib/tnl-ports.c b/lib/tnl-ports.c
> index 58269d3b1..f9fee3793 100644
> --- a/lib/tnl-ports.c
> +++ b/lib/tnl-ports.c
> @@ -259,14 +259,14 @@ ipdev_map_delete(struct ip_device *ip_dev, ovs_be16 
> tp_port, uint8_t nw_proto)
>  void
>  tnl_port_map_delete(odp_port_t port, const char type[])
>  {
> -    struct tnl_port *p, *next;
> +    struct tnl_port *p;
>      struct ip_device *ip_dev;
>      uint8_t nw_proto;
>
>      nw_proto = tnl_type_to_nw_proto(type);
>
>      ovs_mutex_lock(&mutex);
> -    LIST_FOR_EACH_SAFE(p, next, node, &port_list) {
> +    LIST_FOR_EACH_SAFE (p, node, &port_list) {
>          if (p->port == port && p->nw_proto == nw_proto &&
>                      ovs_refcount_unref_relaxed(&p->ref_cnt) == 1) {
>              ovs_list_remove(&p->node);
> @@ -444,11 +444,11 @@ delete_ipdev(struct ip_device *ip_dev)
>  void
>  tnl_port_map_insert_ipdev(const char dev_name[])
>  {
> -    struct ip_device *ip_dev, *next;
> +    struct ip_device *ip_dev;
>
>      ovs_mutex_lock(&mutex);
>
> -    LIST_FOR_EACH_SAFE(ip_dev, next, node, &addr_list) {
> +    LIST_FOR_EACH_SAFE (ip_dev, node, &addr_list) {
>          if (!strcmp(netdev_get_name(ip_dev->dev), dev_name)) {
>              if (ip_dev->change_seq == netdev_get_change_seq(ip_dev->dev)) {
>                  goto out;
> @@ -466,10 +466,10 @@ out:
>  void
>  tnl_port_map_delete_ipdev(const char dev_name[])
>  {
> -    struct ip_device *ip_dev, *next;
> +    struct ip_device *ip_dev;
>
>      ovs_mutex_lock(&mutex);
> -    LIST_FOR_EACH_SAFE(ip_dev, next, node, &addr_list) {
> +    LIST_FOR_EACH_SAFE (ip_dev, node, &addr_list) {
>          if (!strcmp(netdev_get_name(ip_dev->dev), dev_name)) {
>              delete_ipdev(ip_dev);
>          }
> @@ -480,10 +480,10 @@ tnl_port_map_delete_ipdev(const char dev_name[])
>  void
>  tnl_port_map_run(void)
>  {
> -    struct ip_device *ip_dev, *next;
> +    struct ip_device *ip_dev;
>
>      ovs_mutex_lock(&mutex);
> -    LIST_FOR_EACH_SAFE(ip_dev, next, node, &addr_list) {
> +    LIST_FOR_EACH_SAFE (ip_dev, node, &addr_list) {
>          char dev_name[IFNAMSIZ];
>
>          if (ip_dev->change_seq == netdev_get_change_seq(ip_dev->dev)) {
> diff --git a/lib/unixctl.c b/lib/unixctl.c
> index 69aed6722..103357ee9 100644
> --- a/lib/unixctl.c
> +++ b/lib/unixctl.c
> @@ -390,8 +390,8 @@ unixctl_server_run(struct unixctl_server *server)
>          }
>      }
>
> -    struct unixctl_conn *conn, *next;
> -    LIST_FOR_EACH_SAFE (conn, next, node, &server->conns) {
> +    struct unixctl_conn *conn;
> +    LIST_FOR_EACH_SAFE (conn, node, &server->conns) {
>          int error = run_connection(conn);
>          if (error && error != EAGAIN) {
>              kill_connection(conn);
> @@ -422,9 +422,9 @@ void
>  unixctl_server_destroy(struct unixctl_server *server)
>  {
>      if (server) {
> -        struct unixctl_conn *conn, *next;
> +        struct unixctl_conn *conn;
>
> -        LIST_FOR_EACH_SAFE (conn, next, node, &server->conns) {
> +        LIST_FOR_EACH_SAFE (conn, node, &server->conns) {
>              kill_connection(conn);
>          }
>
> diff --git a/lib/vconn.c b/lib/vconn.c
> index 7415e6291..b55676227 100644
> --- a/lib/vconn.c
> +++ b/lib/vconn.c
> @@ -960,8 +960,8 @@ vconn_transact_multipart(struct vconn *vconn,
>      ovs_list_init(replies);
>
>      /* Send all the requests. */
> -    struct ofpbuf *b, *next;
> -    LIST_FOR_EACH_SAFE (b, next, list_node, requests) {
> +    struct ofpbuf *b;
> +    LIST_FOR_EACH_SAFE (b, list_node, requests) {
>          ovs_list_remove(&b->list_node);
>          int error = vconn_send_block(vconn, b);
>          if (error) {
> diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c
> index fa8f6cd0e..5666d7283 100644
> --- a/ofproto/connmgr.c
> +++ b/ofproto/connmgr.c
> @@ -351,8 +351,8 @@ connmgr_run(struct connmgr *mgr,
>          }
>      }
>
> -    struct ofconn *ofconn, *next_ofconn;
> -    LIST_FOR_EACH_SAFE (ofconn, next_ofconn, connmgr_node, &mgr->conns) {
> +    struct ofconn *ofconn;
> +    LIST_FOR_EACH_SAFE (ofconn, connmgr_node, &mgr->conns) {
>          ofconn_run(ofconn, handle_openflow);
>      }
>      ofmonitor_run(mgr);
> @@ -1953,8 +1953,8 @@ static void
>  ofservice_close_all(struct ofservice *ofservice)
>      OVS_REQUIRES(ofproto_mutex)
>  {
> -    struct ofconn *ofconn, *next;
> -    LIST_FOR_EACH_SAFE (ofconn, next, ofservice_node, &ofservice->conns) {
> +    struct ofconn *ofconn;
> +    LIST_FOR_EACH_SAFE (ofconn, ofservice_node, &ofservice->conns) {
>          ofconn_destroy(ofconn);
>      }
>  }
> diff --git a/ofproto/ofproto-dpif-ipfix.c b/ofproto/ofproto-dpif-ipfix.c
> index 9280e008e..ff4b6339a 100644
> --- a/ofproto/ofproto-dpif-ipfix.c
> +++ b/ofproto/ofproto-dpif-ipfix.c
> @@ -2799,7 +2799,7 @@ dpif_ipfix_cache_expire(struct dpif_ipfix_exporter 
> *exporter,
>                          bool forced_end, const uint64_t export_time_usec,
>                          const uint32_t export_time_sec)
>  {
> -    struct ipfix_flow_cache_entry *entry, *next_entry;
> +    struct ipfix_flow_cache_entry *entry;
>      uint64_t max_flow_start_timestamp_usec;
>      bool template_msg_sent = false;
>      enum ipfix_flow_end_reason flow_end_reason;
> @@ -2811,7 +2811,7 @@ dpif_ipfix_cache_expire(struct dpif_ipfix_exporter 
> *exporter,
>      max_flow_start_timestamp_usec = export_time_usec -
>          1000000LL * exporter->cache_active_timeout;
>
> -    LIST_FOR_EACH_SAFE (entry, next_entry, 
> cache_flow_start_timestamp_list_node,
> +    LIST_FOR_EACH_SAFE (entry, cache_flow_start_timestamp_list_node,
>                          &exporter->cache_flow_start_timestamp_list) {
>          if (forced_end) {
>              flow_end_reason = FORCED_END;
> diff --git a/ofproto/ofproto-dpif-trace.c b/ofproto/ofproto-dpif-trace.c
> index 78a54c715..109940ad2 100644
> --- a/ofproto/ofproto-dpif-trace.c
> +++ b/ofproto/ofproto-dpif-trace.c
> @@ -65,8 +65,8 @@ static void
>  oftrace_node_list_destroy(struct ovs_list *nodes)
>  {
>      if (nodes) {
> -        struct oftrace_node *node, *next;
> -        LIST_FOR_EACH_SAFE (node, next, node, nodes) {
> +        struct oftrace_node *node;
> +        LIST_FOR_EACH_SAFE (node, node, nodes) {
>              ovs_list_remove(&node->node);
>              oftrace_node_destroy(node);
>          }
> diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
> index cc9c1c628..922e02e97 100644
> --- a/ofproto/ofproto-dpif-xlate.c
> +++ b/ofproto/ofproto-dpif-xlate.c
> @@ -1282,7 +1282,7 @@ xlate_ofproto_set(struct ofproto_dpif *ofproto, const 
> char *name,
>  static void
>  xlate_xbridge_remove(struct xlate_cfg *xcfg, struct xbridge *xbridge)
>  {
> -    struct xbundle *xbundle, *next_xbundle;
> +    struct xbundle *xbundle;
>      struct xport *xport, *next_xport;
>
>      if (!xbridge) {
> @@ -1293,7 +1293,7 @@ xlate_xbridge_remove(struct xlate_cfg *xcfg, struct 
> xbridge *xbridge)
>          xlate_xport_remove(xcfg, xport);
>      }
>
> -    LIST_FOR_EACH_SAFE (xbundle, next_xbundle, list_node, 
> &xbridge->xbundles) {
> +    LIST_FOR_EACH_SAFE (xbundle, list_node, &xbridge->xbundles) {
>          xlate_xbundle_remove(xcfg, xbundle);
>      }
>
> diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
> index a4c44052d..9d4d55afb 100644
> --- a/ofproto/ofproto-dpif.c
> +++ b/ofproto/ofproto-dpif.c
> @@ -1936,7 +1936,7 @@ run(struct ofproto *ofproto_)
>
>      new_dump_seq = seq_read(udpif_dump_seq(ofproto->backer->udpif));
>      if (ofproto->dump_seq != new_dump_seq) {
> -        struct rule *rule, *next_rule;
> +        struct rule *rule;
>          long long now = time_msec();
>
>          /* We know stats are relatively fresh, so now is a good time to do 
> some
> @@ -1946,7 +1946,7 @@ run(struct ofproto *ofproto_)
>          /* Expire OpenFlow flows whose idle_timeout or hard_timeout
>           * has passed. */
>          ovs_mutex_lock(&ofproto_mutex);
> -        LIST_FOR_EACH_SAFE (rule, next_rule, expirable,
> +        LIST_FOR_EACH_SAFE (rule, expirable,
>                              &ofproto->up.expirable) {
>              rule_expire(rule_dpif_cast(rule), now);
>          }
> @@ -3103,11 +3103,11 @@ bundle_flush_macs(struct ofbundle *bundle, bool 
> all_ofprotos)
>  {
>      struct ofproto_dpif *ofproto = bundle->ofproto;
>      struct mac_learning *ml = ofproto->ml;
> -    struct mac_entry *mac, *next_mac;
> +    struct mac_entry *mac;
>
>      ofproto->backer->need_revalidate = REV_RECONFIGURE;
>      ovs_rwlock_wrlock(&ml->rwlock);
> -    LIST_FOR_EACH_SAFE (mac, next_mac, lru_node, &ml->lrus) {
> +    LIST_FOR_EACH_SAFE (mac, lru_node, &ml->lrus) {
>          if (mac_entry_get_port(ml, mac) == bundle) {
>              if (all_ofprotos) {
>                  struct ofproto_dpif *o;
> @@ -3138,13 +3138,13 @@ bundle_move(struct ofbundle *old, struct ofbundle 
> *new)
>  {
>      struct ofproto_dpif *ofproto = old->ofproto;
>      struct mac_learning *ml = ofproto->ml;
> -    struct mac_entry *mac, *next_mac;
> +    struct mac_entry *mac;
>
>      ovs_assert(new->ofproto == old->ofproto);
>
>      ofproto->backer->need_revalidate = REV_RECONFIGURE;
>      ovs_rwlock_wrlock(&ml->rwlock);
> -    LIST_FOR_EACH_SAFE (mac, next_mac, lru_node, &ml->lrus) {
> +    LIST_FOR_EACH_SAFE (mac, lru_node, &ml->lrus) {
>          if (mac_entry_get_port(ml, mac) == old) {
>              mac_entry_set_port(ml, mac, new);
>          }
> @@ -3241,7 +3241,7 @@ static void
>  bundle_destroy(struct ofbundle *bundle)
>  {
>      struct ofproto_dpif *ofproto;
> -    struct ofport_dpif *port, *next_port;
> +    struct ofport_dpif *port;
>
>      if (!bundle) {
>          return;
> @@ -3254,7 +3254,7 @@ bundle_destroy(struct ofbundle *bundle)
>      xlate_bundle_remove(bundle);
>      xlate_txn_commit();
>
> -    LIST_FOR_EACH_SAFE (port, next_port, bundle_node, &bundle->ports) {
> +    LIST_FOR_EACH_SAFE (port, bundle_node, &bundle->ports) {
>          bundle_del_port(port);
>      }
>
> @@ -3344,9 +3344,7 @@ bundle_set(struct ofproto *ofproto_, void *aux,
>          }
>      }
>      if (!ok || ovs_list_size(&bundle->ports) != s->n_members) {
> -        struct ofport_dpif *next_port;
> -
> -        LIST_FOR_EACH_SAFE (port, next_port, bundle_node, &bundle->ports) {
> +        LIST_FOR_EACH_SAFE (port, bundle_node, &bundle->ports) {
>              for (i = 0; i < s->n_members; i++) {
>                  if (s->members[i] == port->up.ofp_port) {
>                      goto found;
> @@ -5551,9 +5549,9 @@ ct_zone_timeout_policy_sweep(struct dpif_backer *backer)
>  {
>      if (!ovs_list_is_empty(&backer->ct_tp_kill_list)
>          && time_msec() >= timeout_policy_cleanup_timer) {
> -        struct ct_timeout_policy *ct_tp, *next;
> +        struct ct_timeout_policy *ct_tp;
>
> -        LIST_FOR_EACH_SAFE (ct_tp, next, list_node, 
> &backer->ct_tp_kill_list) {
> +        LIST_FOR_EACH_SAFE (ct_tp, list_node, &backer->ct_tp_kill_list) {
>              if (!ct_dpif_del_timeout_policy(backer->dpif, ct_tp->tp_id)) {
>                  ovs_list_remove(&ct_tp->list_node);
>                  ct_timeout_policy_destroy(ct_tp, backer->tp_ids);
> diff --git a/ovsdb/jsonrpc-server.c b/ovsdb/jsonrpc-server.c
> index 351c39d8a..d091602d5 100644
> --- a/ovsdb/jsonrpc-server.c
> +++ b/ovsdb/jsonrpc-server.c
> @@ -585,9 +585,9 @@ ovsdb_jsonrpc_session_set_options(struct 
> ovsdb_jsonrpc_session *session,
>  static void
>  ovsdb_jsonrpc_session_run_all(struct ovsdb_jsonrpc_remote *remote)
>  {
> -    struct ovsdb_jsonrpc_session *s, *next;
> +    struct ovsdb_jsonrpc_session *s;
>
> -    LIST_FOR_EACH_SAFE (s, next, node, &remote->sessions) {
> +    LIST_FOR_EACH_SAFE (s, node, &remote->sessions) {
>          int error = ovsdb_jsonrpc_session_run(s);
>          if (error) {
>              ovsdb_jsonrpc_session_close(s);
> @@ -642,9 +642,9 @@ ovsdb_jsonrpc_session_get_memory_usage_all(
>  static void
>  ovsdb_jsonrpc_session_close_all(struct ovsdb_jsonrpc_remote *remote)
>  {
> -    struct ovsdb_jsonrpc_session *s, *next;
> +    struct ovsdb_jsonrpc_session *s;
>
> -    LIST_FOR_EACH_SAFE (s, next, node, &remote->sessions) {
> +    LIST_FOR_EACH_SAFE (s, node, &remote->sessions) {
>          ovsdb_jsonrpc_session_close(s);
>      }
>  }
> @@ -660,9 +660,9 @@ static void
>  ovsdb_jsonrpc_session_reconnect_all(struct ovsdb_jsonrpc_remote *remote,
>                                      bool force, const char *comment)
>  {
> -    struct ovsdb_jsonrpc_session *s, *next;
> +    struct ovsdb_jsonrpc_session *s;
>
> -    LIST_FOR_EACH_SAFE (s, next, node, &remote->sessions) {
> +    LIST_FOR_EACH_SAFE (s, node, &remote->sessions) {
>          if (force || !s->db_change_aware) {
>              jsonrpc_session_force_reconnect(s->js);
>              if (comment && jsonrpc_session_is_connected(s->js)) {
> @@ -1226,8 +1226,8 @@ ovsdb_jsonrpc_trigger_complete_all(struct 
> ovsdb_jsonrpc_session *s)
>  static void
>  ovsdb_jsonrpc_trigger_complete_done(struct ovsdb_jsonrpc_session *s)
>  {
> -    struct ovsdb_jsonrpc_trigger *trigger, *next;
> -    LIST_FOR_EACH_SAFE (trigger, next, trigger.node, &s->up.completions) {
> +    struct ovsdb_jsonrpc_trigger *trigger;
> +    LIST_FOR_EACH_SAFE (trigger, trigger.node, &s->up.completions) {
>          ovsdb_jsonrpc_trigger_complete(trigger);
>      }
>  }
> diff --git a/ovsdb/monitor.c b/ovsdb/monitor.c
> index 0f222cc99..513f37b1b 100644
> --- a/ovsdb/monitor.c
> +++ b/ovsdb/monitor.c
> @@ -638,8 +638,8 @@ ovsdb_monitor_change_set_destroy(struct 
> ovsdb_monitor_change_set *mcs)
>  {
>      ovs_list_remove(&mcs->list_node);
>
> -    struct ovsdb_monitor_change_set_for_table *mcst, *next_mcst;
> -    LIST_FOR_EACH_SAFE (mcst, next_mcst, list_in_change_set,
> +    struct ovsdb_monitor_change_set_for_table *mcst;
> +    LIST_FOR_EACH_SAFE (mcst, list_in_change_set,
>                          &mcs->change_set_for_tables) {
>          ovs_list_remove(&mcst->list_in_change_set);
>          ovs_list_remove(&mcst->list_in_mt);
> @@ -1711,8 +1711,8 @@ ovsdb_monitor_destroy(struct ovsdb_monitor *dbmon)
>      ovsdb_monitor_json_cache_flush(dbmon);
>      hmap_destroy(&dbmon->json_cache);
>
> -    struct ovsdb_monitor_change_set *cs, *cs_next;
> -    LIST_FOR_EACH_SAFE (cs, cs_next, list_node, &dbmon->change_sets) {
> +    struct ovsdb_monitor_change_set *cs;
> +    LIST_FOR_EACH_SAFE (cs, list_node, &dbmon->change_sets) {
>          ovsdb_monitor_change_set_destroy(cs);
>      }
>
> @@ -1760,14 +1760,14 @@ ovsdb_monitors_commit(struct ovsdb *db, const struct 
> ovsdb_txn *txn)
>  void
>  ovsdb_monitors_remove(struct ovsdb *db)
>  {
> -    struct ovsdb_monitor *m, *next_m;
> +    struct ovsdb_monitor *m;
>
> -    LIST_FOR_EACH_SAFE (m, next_m, list_node, &db->monitors) {
> -        struct jsonrpc_monitor_node *jm, *next_jm;
> +    LIST_FOR_EACH_SAFE (m, list_node, &db->monitors) {
> +        struct jsonrpc_monitor_node *jm;
>
>          /* Delete all front-end monitors.  Removing the last front-end 
> monitor
>           * will also destroy the corresponding ovsdb_monitor. */
> -        LIST_FOR_EACH_SAFE (jm, next_jm, node, &m->jsonrpc_monitors) {
> +        LIST_FOR_EACH_SAFE (jm, node, &m->jsonrpc_monitors) {
>              ovsdb_jsonrpc_monitor_destroy(jm->jsonrpc_monitor, false);
>          }
>      }
> @@ -1789,14 +1789,14 @@ ovsdb_monitor_get_memory_usage(struct simap *usage)
>  void
>  ovsdb_monitor_prereplace_db(struct ovsdb *db)
>  {
> -    struct ovsdb_monitor *m, *next_m;
> +    struct ovsdb_monitor *m;
>
> -    LIST_FOR_EACH_SAFE (m, next_m, list_node, &db->monitors) {
> -        struct jsonrpc_monitor_node *jm, *next_jm;
> +    LIST_FOR_EACH_SAFE (m, list_node, &db->monitors) {
> +        struct jsonrpc_monitor_node *jm;
>
>          /* Delete all front-end monitors.  Removing the last front-end 
> monitor
>           * will also destroy the corresponding ovsdb_monitor. */
> -        LIST_FOR_EACH_SAFE (jm, next_jm, node, &m->jsonrpc_monitors) {
> +        LIST_FOR_EACH_SAFE (jm, node, &m->jsonrpc_monitors) {
>              ovsdb_jsonrpc_monitor_destroy(jm->jsonrpc_monitor, true);
>          }
>      }
> diff --git a/ovsdb/ovsdb.c b/ovsdb/ovsdb.c
> index e6d866182..91b4a01af 100644
> --- a/ovsdb/ovsdb.c
> +++ b/ovsdb/ovsdb.c
> @@ -571,8 +571,8 @@ ovsdb_replace(struct ovsdb *dst, struct ovsdb *src)
>      ovsdb_monitor_prereplace_db(dst);
>
>      /* Cancel triggers. */
> -    struct ovsdb_trigger *trigger, *next;
> -    LIST_FOR_EACH_SAFE (trigger, next, node, &dst->triggers) {
> +    struct ovsdb_trigger *trigger;
> +    LIST_FOR_EACH_SAFE (trigger, node, &dst->triggers) {
>          ovsdb_trigger_prereplace_db(trigger);
>      }
>
> diff --git a/ovsdb/raft.c b/ovsdb/raft.c
> index 855404808..23a2728f3 100644
> --- a/ovsdb/raft.c
> +++ b/ovsdb/raft.c
> @@ -1384,8 +1384,8 @@ raft_close__(struct raft *raft)
>          raft->remove_server = NULL;
>      }
>
> -    struct raft_conn *conn, *next;
> -    LIST_FOR_EACH_SAFE (conn, next, list_node, &raft->conns) {
> +    struct raft_conn *conn;
> +    LIST_FOR_EACH_SAFE (conn, list_node, &raft->conns) {
>          raft_conn_close(conn);
>      }
>  }
> @@ -1721,8 +1721,8 @@ raft_waiters_run(struct raft *raft)
>      }
>
>      uint64_t cur = ovsdb_log_commit_progress(raft->log);
> -    struct raft_waiter *w, *next;
> -    LIST_FOR_EACH_SAFE (w, next, list_node, &raft->waiters) {
> +    struct raft_waiter *w;
> +    LIST_FOR_EACH_SAFE (w, list_node, &raft->waiters) {
>          if (cur < w->commit_ticket) {
>              break;
>          }
> @@ -1744,8 +1744,8 @@ raft_waiters_wait(struct raft *raft)
>  static void
>  raft_waiters_destroy(struct raft *raft)
>  {
> -    struct raft_waiter *w, *next;
> -    LIST_FOR_EACH_SAFE (w, next, list_node, &raft->waiters) {
> +    struct raft_waiter *w;
> +    LIST_FOR_EACH_SAFE (w, list_node, &raft->waiters) {
>          raft_waiter_destroy(w);
>      }
>  }
> @@ -1968,8 +1968,7 @@ raft_run(struct raft *raft)
>
>      /* Close unneeded sessions. */
>      struct raft_server *server;
> -    struct raft_conn *next;
> -    LIST_FOR_EACH_SAFE (conn, next, list_node, &raft->conns) {
> +    LIST_FOR_EACH_SAFE (conn, list_node, &raft->conns) {
>          if (!raft_conn_should_stay_open(raft, conn)) {
>              server = raft_find_new_server(raft, &conn->sid);
>              if (server) {
> diff --git a/ovsdb/transaction-forward.c b/ovsdb/transaction-forward.c
> index d15f2f1d6..4549e3427 100644
> --- a/ovsdb/transaction-forward.c
> +++ b/ovsdb/transaction-forward.c
> @@ -126,10 +126,10 @@ ovsdb_txn_forward_steal_reply(struct ovsdb_txn_forward 
> *txn_fwd)
>  void
>  ovsdb_txn_forward_run(struct ovsdb *db, struct ovsdb_cs *cs)
>  {
> -    struct ovsdb_txn_forward *t, *next;
> +    struct ovsdb_txn_forward *t;
>
>      /* Send all transactions that needs to be forwarded. */
> -    LIST_FOR_EACH_SAFE (t, next, new_node, &db->txn_forward_new) {
> +    LIST_FOR_EACH_SAFE (t, new_node, &db->txn_forward_new) {
>          if (!ovsdb_cs_may_send_transaction(cs)) {
>              break;
>          }
> @@ -177,7 +177,7 @@ ovsdb_txn_forward_cancel_all(struct ovsdb *db, bool 
> sent_only)
>          return;
>      }
>
> -    LIST_FOR_EACH_SAFE (t, next, new_node, &db->txn_forward_new) {
> +    LIST_FOR_EACH_SAFE (t, new_node, &db->txn_forward_new) {
>          ovsdb_txn_forward_cancel(db, t);
>      }
>  }
> diff --git a/ovsdb/transaction.c b/ovsdb/transaction.c
> index 090068603..3b96a3a14 100644
> --- a/ovsdb/transaction.c
> +++ b/ovsdb/transaction.c
> @@ -159,15 +159,15 @@ ovsdb_txn_row_abort(struct ovsdb_txn *txn OVS_UNUSED,
>          hmap_replace(&new->table->rows, &new->hmap_node, &old->hmap_node);
>      }
>
> -    struct ovsdb_weak_ref *weak, *next;
> -    LIST_FOR_EACH_SAFE (weak, next, src_node, &txn_row->deleted_refs) {
> +    struct ovsdb_weak_ref *weak;
> +    LIST_FOR_EACH_SAFE (weak, src_node, &txn_row->deleted_refs) {
>          ovs_list_remove(&weak->src_node);
>          ovs_list_init(&weak->src_node);
>          if (hmap_node_is_null(&weak->dst_node)) {
>              ovsdb_weak_ref_destroy(weak);
>          }
>      }
> -    LIST_FOR_EACH_SAFE (weak, next, src_node, &txn_row->added_refs) {
> +    LIST_FOR_EACH_SAFE (weak, src_node, &txn_row->added_refs) {
>          ovs_list_remove(&weak->src_node);
>          ovs_list_init(&weak->src_node);
>          if (hmap_node_is_null(&weak->dst_node)) {
> @@ -508,11 +508,11 @@ static struct ovsdb_error *
>  ovsdb_txn_update_weak_refs(struct ovsdb_txn *txn OVS_UNUSED,
>                             struct ovsdb_txn_row *txn_row)
>  {
> -    struct ovsdb_weak_ref *weak, *next, *dst_weak;
> +    struct ovsdb_weak_ref *weak, *dst_weak;
>      struct ovsdb_row *dst_row;
>
>      /* Find and clean up deleted references from destination rows. */
> -    LIST_FOR_EACH_SAFE (weak, next, src_node, &txn_row->deleted_refs) {
> +    LIST_FOR_EACH_SAFE (weak, src_node, &txn_row->deleted_refs) {
>          dst_row = CONST_CAST(struct ovsdb_row *,
>                      ovsdb_table_get_row(weak->dst_table, &weak->dst));
>          if (dst_row) {
> @@ -529,7 +529,7 @@ ovsdb_txn_update_weak_refs(struct ovsdb_txn *txn 
> OVS_UNUSED,
>      }
>
>      /* Insert the weak references added in the new version of the row. */
> -    LIST_FOR_EACH_SAFE (weak, next, src_node, &txn_row->added_refs) {
> +    LIST_FOR_EACH_SAFE (weak, src_node, &txn_row->added_refs) {
>          dst_row = CONST_CAST(struct ovsdb_row *,
>                      ovsdb_table_get_row(weak->dst_table, &weak->dst));
>
> @@ -597,7 +597,7 @@ find_and_add_weak_ref(struct ovsdb_txn_row *txn_row,
>  static struct ovsdb_error * OVS_WARN_UNUSED_RESULT
>  assess_weak_refs(struct ovsdb_txn *txn, struct ovsdb_txn_row *txn_row)
>  {
> -    struct ovsdb_weak_ref *weak, *next;
> +    struct ovsdb_weak_ref *weak;
>      struct ovsdb_table *table;
>      struct shash_node *node;
>
> @@ -642,7 +642,7 @@ assess_weak_refs(struct ovsdb_txn *txn, struct 
> ovsdb_txn_row *txn_row)
>
>          /* Collecting all key-value pairs that references deleted rows. */
>          ovsdb_datum_init_empty(&deleted_refs);
> -        LIST_FOR_EACH_SAFE (weak, next, src_node, &txn_row->deleted_refs) {
> +        LIST_FOR_EACH_SAFE (weak, src_node, &txn_row->deleted_refs) {
>              if (column->index == weak->column_idx) {
>                  ovsdb_datum_add_unsafe(&deleted_refs, &weak->key, 
> &weak->value,
>                                         &column->type, NULL);
> @@ -1094,8 +1094,8 @@ static void
>  ovsdb_txn_destroy_cloned(struct ovsdb_txn *txn)
>  {
>      ovs_assert(!txn->db);
> -    struct ovsdb_txn_table *t, *next_txn_table;
> -    LIST_FOR_EACH_SAFE (t, next_txn_table, node, &txn->txn_tables) {
> +    struct ovsdb_txn_table *t;
> +    LIST_FOR_EACH_SAFE (t, node, &txn->txn_tables) {
>          struct ovsdb_txn_row *r, *next_txn_row;
>          HMAP_FOR_EACH_SAFE (r, next_txn_row, hmap_node, &t->txn_rows) {
>              if (r->old) {
> @@ -1550,10 +1550,10 @@ for_each_txn_row(struct ovsdb_txn *txn,
>      serial++;
>
>      do {
> -        struct ovsdb_txn_table *t, *next_txn_table;
> +        struct ovsdb_txn_table *t;
>
>          any_work = false;
> -        LIST_FOR_EACH_SAFE (t, next_txn_table, node, &txn->txn_tables) {
> +        LIST_FOR_EACH_SAFE (t, node, &txn->txn_tables) {
>              if (t->serial != serial) {
>                  t->serial = serial;
>                  t->n_processed = 0;
> @@ -1630,8 +1630,8 @@ ovsdb_txn_history_destroy(struct ovsdb *db)
>          return;
>      }
>
> -    struct ovsdb_txn_history_node *txn_h_node, *next;
> -    LIST_FOR_EACH_SAFE (txn_h_node, next, node, &db->txn_history) {
> +    struct ovsdb_txn_history_node *txn_h_node;
> +    LIST_FOR_EACH_SAFE (txn_h_node, node, &db->txn_history) {
>          ovs_list_remove(&txn_h_node->node);
>          ovsdb_txn_destroy_cloned(txn_h_node->txn);
>          free(txn_h_node);
> diff --git a/ovsdb/trigger.c b/ovsdb/trigger.c
> index 726c138bf..7d3003bca 100644
> --- a/ovsdb/trigger.c
> +++ b/ovsdb/trigger.c
> @@ -146,14 +146,14 @@ ovsdb_trigger_prereplace_db(struct ovsdb_trigger 
> *trigger)
>  bool
>  ovsdb_trigger_run(struct ovsdb *db, long long int now)
>  {
> -    struct ovsdb_trigger *t, *next;
> +    struct ovsdb_trigger *t;
>
>      bool run_triggers = db->run_triggers;
>      db->run_triggers_now = db->run_triggers = false;
>
>      bool disconnect_all = false;
>
> -    LIST_FOR_EACH_SAFE (t, next, node, &db->triggers) {
> +    LIST_FOR_EACH_SAFE (t, node, &db->triggers) {
>          if (run_triggers
>              || now - t->created >= t->timeout_msec
>              || t->progress || t->txn_forward) {
> diff --git a/tests/test-list.c b/tests/test-list.c
> index 7c02ea40f..e2edcbfd1 100644
> --- a/tests/test-list.c
> +++ b/tests/test-list.c
> @@ -164,6 +164,35 @@ test_list_for_each_safe(void)
>                  }
>              }
>              assert(n == n_remaining);
> +
> +            /* Test short version (without next variable) */

Ending sentence with a dot.

> +            make_list(&list, elements, values, n);
> +
> +            i = 0;
> +            values_idx = 0;
> +            n_remaining = n;
> +            LIST_FOR_EACH_SAFE (e, node, &list) {
> +                assert(i < n);
> +                if (pattern & (1ul << i)) {
> +                    ovs_list_remove(&e->node);
> +                    n_remaining--;
> +                    memmove(&values[values_idx], &values[values_idx + 1],
> +                            sizeof *values * (n_remaining - values_idx));
> +                } else {
> +                    values_idx++;
> +                }
> +
> +                check_list(&list, values, n_remaining);
> +                i++;
> +            }
> +            assert(i == n);
> +            assert(e == NULL);
> +
> +            for (i = 0; i < n; i++) {
> +                if (pattern & (1ul << i)) {
> +                    n_remaining++;
> +                }
> +            }
>          }
>      }
>  }
> diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
> index ede7f1e61..6771973ae 100644
> --- a/utilities/ovs-ofctl.c
> +++ b/utilities/ovs-ofctl.c
> @@ -730,12 +730,12 @@ static void
>  bundle_print_errors(struct ovs_list *errors, struct ovs_list *requests,
>                      const char *vconn_name)
>  {
> -    struct ofpbuf *error, *next;
> +    struct ofpbuf *error;
>      struct ofpbuf *bmsg;
>
>      INIT_CONTAINER(bmsg, requests, list_node);
>
> -    LIST_FOR_EACH_SAFE (error, next, list_node, errors) {
> +    LIST_FOR_EACH_SAFE (error, list_node, errors) {
>          const struct ofp_header *error_oh = error->data;
>          ovs_be32 error_xid = error_oh->xid;
>          enum ofperr ofperr;
> diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c
> index 37cc72d40..812455eea 100644
> --- a/utilities/ovs-vsctl.c
> +++ b/utilities/ovs-vsctl.c
> @@ -1510,13 +1510,13 @@ cmd_add_br(struct ctl_context *ctx)
>  static void
>  del_port(struct vsctl_context *vsctl_ctx, struct vsctl_port *port)
>  {
> -    struct vsctl_iface *iface, *next_iface;
> +    struct vsctl_iface *iface;
>
>      bridge_delete_port((port->bridge->parent
>                          ? port->bridge->parent->br_cfg
>                          : port->bridge->br_cfg), port->port_cfg);
>
> -    LIST_FOR_EACH_SAFE (iface, next_iface, ifaces_node, &port->ifaces) {
> +    LIST_FOR_EACH_SAFE (iface, ifaces_node, &port->ifaces) {
>          del_cached_iface(vsctl_ctx, iface);
>      }
>      del_cached_port(vsctl_ctx, port);
> @@ -1526,14 +1526,14 @@ static void
>  del_bridge(struct vsctl_context *vsctl_ctx, struct vsctl_bridge *br)
>  {
>      struct vsctl_bridge *child, *next_child;
> -    struct vsctl_port *port, *next_port;
> +    struct vsctl_port *port;
>      const struct ovsrec_flow_sample_collector_set *fscset, *next_fscset;
>
>      HMAP_FOR_EACH_SAFE (child, next_child, children_node, &br->children) {
>          del_bridge(vsctl_ctx, child);
>      }
>
> -    LIST_FOR_EACH_SAFE (port, next_port, ports_node, &br->ports) {
> +    LIST_FOR_EACH_SAFE (port, ports_node, &br->ports) {
>          del_port(vsctl_ctx, port);
>      }
>
> diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
> index 5223aa897..b1bc51bd5 100644
> --- a/vswitchd/bridge.c
> +++ b/vswitchd/bridge.c
> @@ -1133,9 +1133,9 @@ bridge_delete_or_reconfigure_ports(struct bridge *br)
>       *       whose module was just unloaded via "rmmod", or a virtual NIC 
> for a
>       *       VM whose VM was just terminated. */
>      HMAP_FOR_EACH_SAFE (port, port_next, hmap_node, &br->ports) {
> -        struct iface *iface, *iface_next;
> +        struct iface *iface;
>
> -        LIST_FOR_EACH_SAFE (iface, iface_next, port_elem, &port->ifaces) {
> +        LIST_FOR_EACH_SAFE (iface, port_elem, &port->ifaces) {
>              if (!sset_contains(&ofproto_ports, iface->name)) {
>                  iface_destroy__(iface);
>              }
> @@ -4341,12 +4341,12 @@ static void
>  bridge_aa_refresh_queued(struct bridge *br)
>  {
>      struct ovs_list *list = xmalloc(sizeof *list);
> -    struct bridge_aa_vlan *node, *next;
> +    struct bridge_aa_vlan *node;
>
>      ovs_list_init(list);
>      ofproto_aa_vlan_get_queued(br->ofproto, list);
>
> -    LIST_FOR_EACH_SAFE (node, next, list_node, list) {
> +    LIST_FOR_EACH_SAFE (node, list_node, list) {
>          struct port *port;
>
>          VLOG_INFO("ifname=%s, vlan=%u, oper=%u", node->port_name, node->vlan,
> @@ -4387,7 +4387,7 @@ port_create(struct bridge *br, const struct ovsrec_port 
> *cfg)
>  static void
>  port_del_ifaces(struct port *port)
>  {
> -    struct iface *iface, *next;
> +    struct iface *iface;
>      struct sset new_ifaces;
>      size_t i;
>
> @@ -4398,7 +4398,7 @@ port_del_ifaces(struct port *port)
>      }
>
>      /* Get rid of deleted interfaces. */
> -    LIST_FOR_EACH_SAFE (iface, next, port_elem, &port->ifaces) {
> +    LIST_FOR_EACH_SAFE (iface, port_elem, &port->ifaces) {
>          if (!sset_contains(&new_ifaces, iface->name)) {
>              iface_destroy(iface);
>          }
> @@ -4412,13 +4412,13 @@ port_destroy(struct port *port)
>  {
>      if (port) {
>          struct bridge *br = port->bridge;
> -        struct iface *iface, *next;
> +        struct iface *iface;
>
>          if (br->ofproto) {
>              ofproto_bundle_unregister(br->ofproto, port);
>          }
>
> -        LIST_FOR_EACH_SAFE (iface, next, port_elem, &port->ifaces) {
> +        LIST_FOR_EACH_SAFE (iface, port_elem, &port->ifaces) {
>              iface_destroy__(iface);
>          }
>
> diff --git a/vtep/vtep-ctl.c b/vtep/vtep-ctl.c
> index ab552457d..3465d899b 100644
> --- a/vtep/vtep-ctl.c
> +++ b/vtep/vtep-ctl.c
> @@ -808,9 +808,9 @@ vtep_ctl_context_invalidate_cache(struct ctl_context *ctx)
>
>          SHASH_FOR_EACH_SAFE (node2, next_node2, &ls->mcast_local) {
>              struct vtep_ctl_mcast_mac *mcast_mac = node2->data;
> -            struct vtep_ctl_ploc *ploc, *next_ploc;
> +            struct vtep_ctl_ploc *ploc;
>
> -            LIST_FOR_EACH_SAFE (ploc, next_ploc, locators_node,
> +            LIST_FOR_EACH_SAFE (ploc, locators_node,
>                                  &mcast_mac->locators) {
>                  free(ploc);
>              }
> @@ -820,9 +820,9 @@ vtep_ctl_context_invalidate_cache(struct ctl_context *ctx)
>
>          SHASH_FOR_EACH_SAFE (node2, next_node2, &ls->mcast_remote) {
>              struct vtep_ctl_mcast_mac *mcast_mac = node2->data;
> -            struct vtep_ctl_ploc *ploc, *next_ploc;
> +            struct vtep_ctl_ploc *ploc;
>
> -            LIST_FOR_EACH_SAFE (ploc, next_ploc, locators_node,
> +            LIST_FOR_EACH_SAFE (ploc, locators_node,
>                                  &mcast_mac->locators) {
>                  free(ploc);
>              }
> @@ -1229,9 +1229,9 @@ del_port(struct vtep_ctl_context *vtepctl_ctx, struct 
> vtep_ctl_port *port)
>  static void
>  del_pswitch(struct vtep_ctl_context *vtepctl_ctx, struct vtep_ctl_pswitch 
> *ps)
>  {
> -    struct vtep_ctl_port *port, *next_port;
> +    struct vtep_ctl_port *port;
>
> -    LIST_FOR_EACH_SAFE (port, next_port, ports_node, &ps->ports) {
> +    LIST_FOR_EACH_SAFE (port, ports_node, &ps->ports) {
>          del_port(vtepctl_ctx, port);
>      }
>
> -- 
> 2.34.1
>
> _______________________________________________
> dev mailing list
> d...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to