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/replication.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/replication.c')
-rw-r--r-- | ovsdb/replication.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ovsdb/replication.c b/ovsdb/replication.c index bb18da8ef..2b9ae2f83 100644 --- a/ovsdb/replication.c +++ b/ovsdb/replication.c @@ -147,8 +147,8 @@ replication_add_local_db(const char *database, struct ovsdb *db) static void send_schema_requests(const struct json *result) { - for (size_t i = 0; i < result->u.array.n; i++) { - const struct json *name = result->u.array.elems[i]; + for (size_t i = 0; i < result->array.n; i++) { + const struct json *name = result->array.elems[i]; if (name->type == JSON_STRING) { /* Send one schema request for each remote DB. */ const char *db_name = json_string(name); @@ -203,13 +203,13 @@ replication_run(void) if (msg->type == JSONRPC_NOTIFY && state != RPL_S_ERR && !strcmp(msg->method, "update")) { if (msg->params->type == JSON_ARRAY - && msg->params->u.array.n == 2 - && msg->params->u.array.elems[0]->type == JSON_STRING) { - char *db_name = msg->params->u.array.elems[0]->u.string; + && msg->params->array.n == 2 + && msg->params->array.elems[0]->type == JSON_STRING) { + char *db_name = msg->params->array.elems[0]->string; struct ovsdb *db = find_db(db_name); if (db) { struct ovsdb_error *error; - error = process_notification(msg->params->u.array.elems[1], + error = process_notification(msg->params->array.elems[1], db); if (error) { ovsdb_error_assert(error); |