diff options
author | Ben Pfaff <blp@ovn.org> | 2016-06-08 22:37:58 -0700 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2016-06-23 15:13:14 -0700 |
commit | 1998e4741d6df0bdd4dd142a519973bfea9777d8 (patch) | |
tree | eebccc34a77a2550dc7973107240bccc9eb6564b /ovn | |
parent | 3239f7a0b0c0ba799aafb782f01af126c016b420 (diff) | |
download | openvswitch-1998e4741d6df0bdd4dd142a519973bfea9777d8.tar.gz |
expr: Shorten declarations of expr_context.
Seems to me that this makes the code slightly easier to follow.
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Ryan Moats <rmoats@us.ibm.com>
Diffstat (limited to 'ovn')
-rw-r--r-- | ovn/lib/expr.c | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/ovn/lib/expr.c b/ovn/lib/expr.c index f274ab46f..7ff9538cf 100644 --- a/ovn/lib/expr.c +++ b/ovn/lib/expr.c @@ -1025,13 +1025,7 @@ expr_parse__(struct expr_context *ctx) struct expr * expr_parse(struct lexer *lexer, const struct shash *symtab, char **errorp) { - struct expr_context ctx; - - ctx.lexer = lexer; - ctx.symtab = symtab; - ctx.error = NULL; - ctx.not = false; - + struct expr_context ctx = { .lexer = lexer, .symtab = symtab }; struct expr *e = expr_parse__(&ctx); *errorp = ctx.error; ovs_assert((ctx.error != NULL) != (e != NULL)); @@ -1108,12 +1102,7 @@ parse_field_from_string(const char *s, const struct shash *symtab, lexer_init(&lexer, s); lexer_get(&lexer); - struct expr_context ctx; - ctx.lexer = &lexer; - ctx.symtab = symtab; - ctx.error = NULL; - ctx.not = false; - + struct expr_context ctx = { .lexer = &lexer, .symtab = symtab }; bool ok = parse_field(&ctx, field); if (!ok) { *errorp = ctx.error; @@ -2861,12 +2850,7 @@ expr_parse_assignment(struct lexer *lexer, const struct shash *symtab, const void *aux, struct ofpbuf *ofpacts, struct expr **prereqsp) { - struct expr_context ctx; - ctx.lexer = lexer; - ctx.symtab = symtab; - ctx.error = NULL; - ctx.not = false; - + struct expr_context ctx = { .lexer = lexer, .symtab = symtab }; struct expr *prereqs = parse_assignment(&ctx, lookup_port, aux, ofpacts); if (ctx.error) { expr_destroy(prereqs); @@ -2881,12 +2865,8 @@ expr_parse_field(struct lexer *lexer, int n_bits, bool rw, const struct shash *symtab, struct mf_subfield *sf, struct expr **prereqsp) { + struct expr_context ctx = { .lexer = lexer, .symtab = symtab }; struct expr *prereqs = NULL; - struct expr_context ctx; - ctx.lexer = lexer; - ctx.symtab = symtab; - ctx.error = NULL; - ctx.not = false; struct expr_field field; if (!parse_field(&ctx, &field)) { |