diff options
author | Adrian Moreno <amorenoz@redhat.com> | 2022-03-23 12:56:17 +0100 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2022-03-30 16:59:02 +0200 |
commit | 9e56549c2bba79e644de2d3876b363553175210c (patch) | |
tree | bf0bf39f86c3e63eda7171f727a6ca3dcc69922b /ovsdb/ovsdb-server.c | |
parent | 860e69a8c3d6994dc000b37d682bd16cd2925bef (diff) | |
download | openvswitch-9e56549c2bba79e644de2d3876b363553175210c.tar.gz |
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 <dceara@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'ovsdb/ovsdb-server.c')
-rw-r--r-- | ovsdb/ovsdb-server.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c index a4f6bca73..8fa937903 100644 --- a/ovsdb/ovsdb-server.c +++ b/ovsdb/ovsdb-server.c @@ -229,8 +229,7 @@ main_loop(struct server_config *config, ovsdb_relay_run(); - struct shash_node *next; - SHASH_FOR_EACH_SAFE (node, next, all_dbs) { + SHASH_FOR_EACH_SAFE (node, all_dbs) { struct db *db = node->data; ovsdb_txn_history_run(db->db); ovsdb_storage_run(db->db->storage); @@ -322,7 +321,7 @@ main(int argc, char *argv[]) FILE *config_tmpfile; struct server_config server_config; struct shash all_dbs; - struct shash_node *node, *next; + struct shash_node *node; int replication_probe_interval = REPLICATION_DEFAULT_PROBE_INTERVAL; ovs_cmdl_proctitle_init(argc, argv); @@ -492,7 +491,7 @@ main(int argc, char *argv[]) main_loop(&server_config, jsonrpc, &all_dbs, unixctl, &remotes, run_process, &exiting, &is_backup); - SHASH_FOR_EACH_SAFE(node, next, &all_dbs) { + SHASH_FOR_EACH_SAFE (node, &all_dbs) { struct db *db = node->data; close_db(&server_config, db, NULL); shash_delete(&all_dbs, node); @@ -1245,8 +1244,8 @@ update_server_status(struct shash *all_dbs) /* Update rows for databases that still exist. * Delete rows for databases that no longer exist. */ - const struct ovsdb_row *row, *next_row; - HMAP_FOR_EACH_SAFE (row, next_row, hmap_node, &database_table->rows) { + const struct ovsdb_row *row; + HMAP_FOR_EACH_SAFE (row, hmap_node, &database_table->rows) { const char *name; ovsdb_util_read_string_column(row, "name", &name); struct db *db = shash_find_data(all_dbs, name); |