[ovs-dev] [PATCH] smap: New macro SMAP_INIT1 for initializing immutable 1-member smaps.

Ben Pfaff blp at nicira.com
Wed Sep 9 01:41:43 UTC 2015


On Tue, Sep 08, 2015 at 08:52:03PM -0400, Russell Bryant wrote:
> On 09/08/2015 04:42 PM, Ben Pfaff wrote:
> > My first name for this was SMAP_CONST_INIT1, but it was too long in my
> > opinion; it forces lines elsewhere to be split.  Do you like
> > SMAP_CONST1?
> 
> SMAP_CONST1 sounds great.  It's still short, yet nicely informative.

Thanks.

Besides that change, I added another use for code that had snuck in
during review of this patch:

diff --git a/ovn/controller/ovn-controller.c b/ovn/controller/ovn-controller.c
index 0f09c1e..8c858bb 100644
--- a/ovn/controller/ovn-controller.c
+++ b/ovn/controller/ovn-controller.c
@@ -95,10 +95,8 @@ create_br_int(struct controller_ctx *ctx,
     bridge = ovsrec_bridge_insert(ctx->ovs_idl_txn);
     ovsrec_bridge_set_name(bridge, bridge_name);
     ovsrec_bridge_set_fail_mode(bridge, "secure");
-    struct smap other_config = SMAP_INITIALIZER(&other_config);
-    smap_add(&other_config, "disable-in-band", "true");
-    ovsrec_bridge_set_other_config(bridge, &other_config);
-    smap_destroy(&other_config);
+    const struct smap oc = SMAP_CONST1(&oc, "disable-in-band", "true");
+    ovsrec_bridge_set_other_config(bridge, &oc);
     ovsrec_bridge_set_ports(bridge, &port, 1);
 
     struct ovsrec_bridge **bridges;

and applied this to master.



More information about the dev mailing list