diff mbox

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

Message ID 20150909014143.GB30877@nicira.com
State Not Applicable
Headers show

Commit Message

Ben Pfaff Sept. 9, 2015, 1:41 a.m. UTC
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 sounds great.  It's still short, yet nicely informative.


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

and applied this to master.
diff mbox


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;