2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

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>
This commit is contained in:
Ben Pfaff
2018-05-24 10:32:59 -07:00
parent 3d62892884
commit fa37affad3
38 changed files with 457 additions and 456 deletions

View File

@@ -1809,12 +1809,12 @@ cmd_show_row(struct ctl_context *ctx, const struct ovsdb_idl_row *row,
datum = ovsdb_idl_read(row, column);
if (column->type.key.type == OVSDB_TYPE_UUID &&
column->type.key.u.uuid.refTableName) {
column->type.key.uuid.refTableName) {
const struct cmd_show_table *ref_show;
size_t j;
ref_show = cmd_show_find_table_by_name(
column->type.key.u.uuid.refTableName);
column->type.key.uuid.refTableName);
if (ref_show) {
for (j = 0; j < datum->n; j++) {
const struct ovsdb_idl_row *ref_row;
@@ -1830,14 +1830,14 @@ cmd_show_row(struct ctl_context *ctx, const struct ovsdb_idl_row *row,
}
} else if (ovsdb_type_is_map(&column->type) &&
column->type.value.type == OVSDB_TYPE_UUID &&
column->type.value.u.uuid.refTableName) {
column->type.value.uuid.refTableName) {
const struct cmd_show_table *ref_show;
size_t j;
/* Prints the key to ref'ed table name map if the ref'ed table
* is also defined in 'cmd_show_tables'. */
ref_show = cmd_show_find_table_by_name(
column->type.value.u.uuid.refTableName);
column->type.value.uuid.refTableName);
if (ref_show && ref_show->name_column) {
ds_put_char_multiple(&ctx->output, ' ', (level + 1) * 4);
ds_put_format(&ctx->output, "%s:\n", column->name);