Changeset: c9e123392f8a for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c9e123392f8a
Modified Files:
common/utils/muuid.c
Branch: Jan2014
Log Message:
Simplify.
diffs (33 lines):
diff --git a/common/utils/muuid.c b/common/utils/muuid.c
--- a/common/utils/muuid.c
+++ b/common/utils/muuid.c
@@ -47,22 +47,16 @@ generateUUID(void)
uuid_unparse(uuid, out);
#else
/* try to do some pseudo interesting stuff, and stash it in the
- * format of an UUID to at least return some uniform answer */
+ * format of a UUID to at least return some uniform answer */
char out[37];
- char *p = out;
/* generate something like this:
* cefa7a9c-1dd2-11b2-8350-880020adbeef ("%08x-%04x-%04x-%04x-%012x") */
- p += snprintf(p, 5, "%04x", rand() % 65536);
- p += snprintf(p, 6, "%04x-", rand() % 65536);
- p += snprintf(p, 6, "%04x-", rand() % 65536);
- p += snprintf(p, 6, "%04x-", rand() % 65536);
- p += snprintf(p, 6, "%04x-", rand() % 65536);
- p += snprintf(p, 5, "%04x", rand() % 65536);
- p += snprintf(p, 5, "%04x", rand() % 65536);
- p += snprintf(p, 5, "%04x", rand() % 65536);
+ snprintf(out, "%04x%04x-%04x-%04x-%04x-%04x%04x%04x",
+ rand() % 65536, rand() % 65536,
+ rand() % 65536, rand() % 65536,
+ rand() % 65536, rand() % 65536,
+ rand() % 65536, rand() % 65536);
#endif
- return(strdup(out));
+ return strdup(out);
}
-
-/* vim:set ts=4 sw=4 noexpandtab: */
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list