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
---
include/openvswitch/json.h| 2 +-
lib/db-ctl-base.c | 8 ++--
lib/dpif-netdev.c | 8 ++--
lib/dpif-netlink.c| 38 +++
lib/dpif.c| 62
lib/dpif.h| 2 +-
lib/json.c| 106 -
lib/jsonrpc.c | 4 +-
lib/netdev-dummy.c| 50 +--
lib/ovsdb-data.c | 72 ++--
lib/ovsdb-idl.c | 58 +++
lib/ovsdb-parser.c| 2 +-
lib/ovsdb-types.c | 108 +-
lib/ovsdb-types.h | 16 +++
ofproto/ofproto-dpif-upcall.c | 66 +-
ofproto/ofproto.c | 12 ++---
ovsdb/column.c| 6 +--
ovsdb/condition.c | 6 +--
ovsdb/execution.c | 14 +++---
ovsdb/file.c | 4 +-
ovsdb/jsonrpc-server.c| 26 +-
ovsdb/log.c | 2 +-
ovsdb/mutation.c | 6 +--
ovsdb/ovsdb-client.c | 66 +-
ovsdb/ovsdb-server.c | 12 ++---
ovsdb/ovsdb-tool.c| 2 +-
ovsdb/ovsdb-util.c| 2 +-
ovsdb/ovsdb.c | 12 ++---
ovsdb/replication.c | 12 ++---
ovsdb/storage.c | 4 +-
ovsdb/table.c | 8 ++--
ovsdb/transaction.c | 8 ++--
ovsdb/trigger.c | 4 +-
python/ovs/db/types.py| 8 ++--
tests/test-json.c | 2 +-
tests/test-jsonrpc.c | 2 +-
tests/test-ovsdb.c| 92 +--
37 files changed, 456 insertions(+), 456 deletions(-)
diff --git a/include/openvswitch/json.h b/include/openvswitch/json.h
index bcf6a27826ae..73b562e03dec 100644
--- a/include/openvswitch/json.h
+++ b/include/openvswitch/json.h
@@ -71,7 +71,7 @@ struct json {
long long int integer;
double real;
char *string;
-} u;
+};
};
struct json *json_null_create(void);
diff --git a/lib/db-ctl-base.c b/lib/db-ctl-base.c
index bfd7a54a8b5a..f2a17f7d1c8f 100644
--- a/lib/db-ctl-base.c
+++ b/lib/db-ctl-base.c
@@ -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(>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(>output, ' ', (level + 1) * 4);
ds_put_format(>output, "%s:\n", column->name);
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 68f2a2975bb9..423bb59f0009 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -3061,19 +3061,19 @@ dpif_netdev_operate(struct dpif *dpif, struct dpif_op
**ops, size_t n_ops)
switch (op->type) {
case DPIF_OP_FLOW_PUT:
-op->error = dpif_netdev_flow_put(dpif, >u.flow_put);
+op->error = dpif_netdev_flow_put(dpif, >flow_put);
break;
case DPIF_OP_FLOW_DEL:
-op->error = dpif_netdev_flow_del(dpif, >u.flow_del);
+