[ovs-dev] [PATCH ovn v2 1/5] ovn-util.h: Call ds_clear() in get_sb_port_group_name().

Han Zhou hzhou at ovn.org
Fri Jun 11 19:35:26 UTC 2021


This moves the burden from caller to the helper function.

Signed-off-by: Han Zhou <hzhou at ovn.org>
---
 lib/ovn-util.h      | 1 +
 northd/ovn-northd.c | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ovn-util.h b/lib/ovn-util.h
index 5533dbd0c..45ee8511c 100644
--- a/lib/ovn-util.h
+++ b/lib/ovn-util.h
@@ -142,6 +142,7 @@ static inline void
 get_sb_port_group_name(const char *nb_pg_name, int64_t dp_tunnel_key,
                        struct ds *sb_pg_name)
 {
+    ds_clear(sb_pg_name);
     ds_put_format(sb_pg_name, "%"PRId64"_%s", dp_tunnel_key, nb_pg_name);
 }
 
diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index d872f6a3c..005c1fc86 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -12638,7 +12638,6 @@ sync_port_groups(struct northd_context *ctx, struct hmap *pgs)
 
         struct ovn_port_group_ls *pg_ls;
         HMAP_FOR_EACH (pg_ls, key_node, &pg->nb_lswitches) {
-            ds_clear(&sb_name);
             get_sb_port_group_name(pg->nb_pg->name, pg_ls->od->sb->tunnel_key,
                                    &sb_name);
             sb_port_group = shash_find_and_delete(&sb_port_groups,
-- 
2.30.2



More information about the dev mailing list