2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-25 15:07:05 +00:00

uuid: New macro UUID_ZERO for an all-zero expression or initializer.

This is convenient in expressions, e.g. "uuid = x ? *x : UUID_ZERO;".

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
This commit is contained in:
Ben Pfaff
2016-11-11 15:47:54 -08:00
parent b5f0fe21a0
commit 42a1d93e29
2 changed files with 4 additions and 1 deletions

View File

@@ -115,7 +115,7 @@ uuid_set_bits_v4(struct uuid *uuid)
void
uuid_zero(struct uuid *uuid)
{
uuid->parts[0] = uuid->parts[1] = uuid->parts[2] = uuid->parts[3] = 0;
*uuid = UUID_ZERO;
}
/* Returns true if 'uuid' is all zero, otherwise false. */

View File

@@ -18,6 +18,9 @@
#include "openvswitch/uuid.h"
/* An initializer or expression for an all-zero UUID. */
#define UUID_ZERO ((struct uuid) { .parts = { 0, 0, 0, 0 } })
/* Formats a UUID as a string, in the conventional format.
*
* Example: