X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fuuid.c;h=620c039cb94318fce788ca15c320ee6c8994248f;hb=8f7501e83f4aa3d395287ef91f4910e32b55643e;hp=264d9bf5afb113f0dc1813d08ca9f90447a66c6f;hpb=d918d9d1128a98e4b2a398a501f541554fed3be8;p=openvswitch diff --git a/lib/uuid.c b/lib/uuid.c index 264d9bf5..620c039c 100644 --- a/lib/uuid.c +++ b/lib/uuid.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2008, 2009 Nicira Networks +/* Copyright (c) 2008, 2009, 2010 Nicira Networks * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -107,6 +107,14 @@ uuid_zero(struct uuid *uuid) uuid->parts[0] = uuid->parts[1] = uuid->parts[2] = uuid->parts[3] = 0; } +/* Returns true if 'uuid' is all zero, otherwise false. */ +bool +uuid_is_zero(const struct uuid *uuid) +{ + return (!uuid->parts[0] && !uuid->parts[1] + && !uuid->parts[2] && !uuid->parts[3]); +} + /* Compares 'a' and 'b'. Returns a negative value if 'a < b', zero if 'a == * b', or positive if 'a > b'. The ordering is lexicographical order of the * conventional way of writing out UUIDs as strings. */