From fa37affad362df15fc59db00aa96ee79cd5eebd9 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 24 May 2018 10:32:59 -0700 Subject: 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 Acked-by: Justin Pettit Tested-by: Alin Gabriel Serdean Acked-by: Alin Gabriel Serdean --- ovsdb/table.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ovsdb/table.c') diff --git a/ovsdb/table.c b/ovsdb/table.c index 7ec55d61f..6cd2d886d 100644 --- a/ovsdb/table.c +++ b/ovsdb/table.c @@ -152,7 +152,7 @@ ovsdb_table_schema_from_json(const struct json *json, const char *name, return ovsdb_syntax_error(json, NULL, "maxRows must be at least 1"); } - n_max_rows = max_rows->u.integer; + n_max_rows = max_rows->integer; } else { n_max_rows = UINT_MAX; } @@ -187,12 +187,12 @@ ovsdb_table_schema_from_json(const struct json *json, const char *name, if (indexes) { size_t i; - ts->indexes = xmalloc(indexes->u.array.n * sizeof *ts->indexes); - for (i = 0; i < indexes->u.array.n; i++) { + ts->indexes = xmalloc(indexes->array.n * sizeof *ts->indexes); + for (i = 0; i < indexes->array.n; i++) { struct ovsdb_column_set *index = &ts->indexes[i]; size_t j; - error = ovsdb_column_set_from_json(indexes->u.array.elems[i], + error = ovsdb_column_set_from_json(indexes->array.elems[i], ts, index); if (error) { goto error; -- cgit v1.2.1