On Tue, Jul 12, 2016 at 08:23:06PM -0700, Ben Pfaff wrote: > This bit of build_lswitch_flows() would probably benefit from {...} > notation: > if (op->lsp_addrs[i].n_ipv6_addrs == 1) { > ds_put_format(&match, "nd.target == %s", > op->lsp_addrs[i].ipv6_addrs[0].addr_s); > } else { > ds_put_cstr(&match, "("); > for (size_t j = 0; j < op->lsp_addrs[i].n_ipv6_addrs; > j++) { > ds_put_format(&match, "nd.target == %s || ", > op->lsp_addrs[i].ipv6_addrs[j].addr_s); > } > ds_chomp(&match, ' '); > ds_chomp(&match, '|'); > ds_chomp(&match, '|'); > ds_chomp(&match, ' '); > ds_put_cstr(&match, ")"); > }
Also it might be worth noting that {} notation allows a trailing comma, e.g. "ip.dst == {1.2.3.4, }" is valid. This might simplify code very slightly in a few places. I've thought about inventing syntax that would allow this for || and && also, e.g. maybe a syntax for "a || b || c", such as "||(a, b, c)" so that "||(a, b, c, )" could be accepted too. This falls somewhere along the line from "that's a good idea!" to "that's a dumb idea and you're dumb for suggesting it", so this is the first time I've brought it up. _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev