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:
@@ -695,7 +695,7 @@ jsonrpc_msg_from_json(struct json *json, struct jsonrpc_msg **msgp)
|
||||
}
|
||||
|
||||
msg = xzalloc(sizeof *msg);
|
||||
msg->method = method ? xstrdup(method->u.string) : NULL;
|
||||
msg->method = method ? xstrdup(method->string) : NULL;
|
||||
msg->params = null_from_json_null(shash_find_and_delete(object, "params"));
|
||||
msg->result = null_from_json_null(shash_find_and_delete(object, "result"));
|
||||
msg->error = null_from_json_null(shash_find_and_delete(object, "error"));
|
||||
@@ -1129,7 +1129,7 @@ jsonrpc_session_recv(struct jsonrpc_session *s)
|
||||
jsonrpc_session_send(s, reply);
|
||||
} else if (msg->type == JSONRPC_REPLY
|
||||
&& msg->id && msg->id->type == JSON_STRING
|
||||
&& !strcmp(msg->id->u.string, "echo")) {
|
||||
&& !strcmp(msg->id->string, "echo")) {
|
||||
/* It's a reply to our echo request. Suppress it. */
|
||||
} else {
|
||||
return msg;
|
||||
|
Reference in New Issue
Block a user