mirror of
https://github.com/openvswitch/ovs
synced 2025-09-01 23:05:29 +00:00
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>
This commit is contained in:
committed by
Ilya Maximets
parent
860e69a8c3
commit
9e56549c2b
@@ -900,8 +900,8 @@ ovsdb_cs_db_get_table(struct ovsdb_cs_db *db, const char *table)
|
||||
static void
|
||||
ovsdb_cs_db_destroy_tables(struct ovsdb_cs_db *db)
|
||||
{
|
||||
struct ovsdb_cs_db_table *table, *next;
|
||||
HMAP_FOR_EACH_SAFE (table, next, hmap_node, &db->tables) {
|
||||
struct ovsdb_cs_db_table *table;
|
||||
HMAP_FOR_EACH_SAFE (table, hmap_node, &db->tables) {
|
||||
json_destroy(table->ack_cond);
|
||||
json_destroy(table->req_cond);
|
||||
json_destroy(table->new_cond);
|
||||
@@ -1794,8 +1794,8 @@ ovsdb_cs_update_server_row(struct server_row *row,
|
||||
static void
|
||||
ovsdb_cs_clear_server_rows(struct ovsdb_cs *cs)
|
||||
{
|
||||
struct server_row *row, *next;
|
||||
HMAP_FOR_EACH_SAFE (row, next, hmap_node, &cs->server_rows) {
|
||||
struct server_row *row;
|
||||
HMAP_FOR_EACH_SAFE (row, hmap_node, &cs->server_rows) {
|
||||
ovsdb_cs_delete_server_row(cs, row);
|
||||
}
|
||||
}
|
||||
@@ -2129,9 +2129,9 @@ void
|
||||
ovsdb_cs_free_schema(struct shash *schema)
|
||||
{
|
||||
if (schema) {
|
||||
struct shash_node *node, *next;
|
||||
struct shash_node *node;
|
||||
|
||||
SHASH_FOR_EACH_SAFE (node, next, schema) {
|
||||
SHASH_FOR_EACH_SAFE (node, schema) {
|
||||
struct sset *sset = node->data;
|
||||
sset_destroy(sset);
|
||||
free(sset);
|
||||
|
Reference in New Issue
Block a user