There is no need to check uuid byte by byte. Also by using size of the uuid
type magic constant can be avoided.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
*/
#include "uuidP.h"
+#include <string.h>
/* Returns 1 if the uuid is the NULL uuid */
int uuid_is_null(const uuid_t uu)
{
- const unsigned char *cp;
- int i;
+ const uuid_t nil = { 0 };
- for (i=0, cp = uu; i < 16; i++)
- if (*cp++)
- return 0;
- return 1;
+ return !memcmp(uu, nil, sizeof(nil));
}
-