Message ID | 1470672872-19450-5-git-send-email-blp@ovn.org |
---|---|
State | Accepted |
Headers | show |
"dev" <dev-bounces@openvswitch.org> wrote on 08/08/2016 11:14:15 AM: > From: Ben Pfaff <blp@ovn.org> > To: dev@openvswitch.org > Cc: Ben Pfaff <blp@ovn.org> > Date: 08/08/2016 11:15 AM > Subject: [ovs-dev] [PATCH v2 04/21] expr: Tolerate having no macros. > Sent by: "dev" <dev-bounces@openvswitch.org> > > A null set of macros seems reasonable, so tolerate it. > > Signed-off-by: Ben Pfaff <blp@ovn.org> > --- > ovn/lib/expr.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/ovn/lib/expr.c b/ovn/lib/expr.c > index cb61b5d..050e694 100644 > --- a/ovn/lib/expr.c > +++ b/ovn/lib/expr.c > @@ -735,7 +735,9 @@ parse_macros(struct expr_context *ctx, struct > expr_constant_set *cs, > size_t *allocated_values) > { > struct expr_constant_set *addr_set > - = shash_find_data(ctx->macros, ctx->lexer->token.s); > + = (ctx->macros > + ? shash_find_data(ctx->macros, ctx->lexer->token.s) > + : NULL); > if (!addr_set) { > expr_syntax_error(ctx, "expecting address set name."); > return false; > -- No surprises with this one, so... Acked-by: Ryan Moats <rmoats@us.ibm.com>
diff --git a/ovn/lib/expr.c b/ovn/lib/expr.c index cb61b5d..050e694 100644 --- a/ovn/lib/expr.c +++ b/ovn/lib/expr.c @@ -735,7 +735,9 @@ parse_macros(struct expr_context *ctx, struct expr_constant_set *cs, size_t *allocated_values) { struct expr_constant_set *addr_set - = shash_find_data(ctx->macros, ctx->lexer->token.s); + = (ctx->macros + ? shash_find_data(ctx->macros, ctx->lexer->token.s) + : NULL); if (!addr_set) { expr_syntax_error(ctx, "expecting address set name."); return false;
A null set of macros seems reasonable, so tolerate it. Signed-off-by: Ben Pfaff <blp@ovn.org> --- ovn/lib/expr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)