diff options
author | Ben Pfaff <blp@ovn.org> | 2018-05-24 10:32:59 -0700 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2018-05-25 13:36:05 -0700 |
commit | fa37affad362df15fc59db00aa96ee79cd5eebd9 (patch) | |
tree | f539cdab21f0951aa8bb7c8b6984d9854d33112d /ovsdb/execution.c | |
parent | 3d62892884d88cf1d0d02f58b3317e6ec0ca8971 (diff) | |
download | openvswitch-fa37affad362df15fc59db00aa96ee79cd5eebd9.tar.gz |
Embrace anonymous unions.
Several OVS structs contain embedded named unions, like this:
struct {
...
union {
...
} u;
};
C11 standardized a feature that many compilers already implemented
anyway, where an embedded union may be unnamed, like this:
struct {
...
union {
...
};
};
This is more convenient because it allows the programmer to omit "u."
in many places. OVS already used this feature in several places. This
commit embraces it in several others.
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
Tested-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>
Diffstat (limited to 'ovsdb/execution.c')
-rw-r--r-- | ovsdb/execution.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/ovsdb/execution.c b/ovsdb/execution.c index 38303c7db..c55a0b771 100644 --- a/ovsdb/execution.c +++ b/ovsdb/execution.c @@ -121,9 +121,9 @@ ovsdb_execute_compose(struct ovsdb *db, const struct ovsdb_session *session, *durable = false; if (params->type != JSON_ARRAY - || !params->u.array.n - || params->u.array.elems[0]->type != JSON_STRING - || strcmp(params->u.array.elems[0]->u.string, db->schema->name)) { + || !params->array.n + || params->array.elems[0]->type != JSON_STRING + || strcmp(params->array.elems[0]->string, db->schema->name)) { if (params->type != JSON_ARRAY) { error = ovsdb_syntax_error(params, NULL, "array expected"); } else { @@ -147,10 +147,10 @@ ovsdb_execute_compose(struct ovsdb *db, const struct ovsdb_session *session, results = NULL; results = json_array_create_empty(); - n_operations = params->u.array.n - 1; + n_operations = params->array.n - 1; error = NULL; for (i = 1; i <= n_operations; i++) { - struct json *operation = params->u.array.elems[i]; + struct json *operation = params->array.elems[i]; struct ovsdb_error *parse_error; struct ovsdb_parser parser; struct json *result; @@ -735,11 +735,11 @@ ovsdb_execute_wait(struct ovsdb_execution *x, struct ovsdb_parser *parser, if (!error) { /* Parse "rows" into 'expected'. */ ovsdb_row_hash_init(&expected, &columns); - for (i = 0; i < rows->u.array.n; i++) { + for (i = 0; i < rows->array.n; i++) { struct ovsdb_row *row; row = ovsdb_row_create(table); - error = ovsdb_row_from_json(row, rows->u.array.elems[i], x->symtab, + error = ovsdb_row_from_json(row, rows->array.elems[i], x->symtab, NULL); if (error) { ovsdb_row_destroy(row); |