]> pd.if.org Git - uuid/commitdiff
improve test case names for t/uuidgen.t
authorNathan Wagner <nw@hydaspes.if.org>
Wed, 24 Sep 2014 00:32:54 +0000 (00:32 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Wed, 24 Sep 2014 00:34:19 +0000 (00:34 +0000)
internal.c
t/uuidgen.c

index c9a72f6da25eefc10d23d75bcb3697fb9175b9a0..597dc7417ad2e1203073d2a756515391e1789ca2 100644 (file)
@@ -489,7 +489,9 @@ int pd_uuid_make_v5(struct pd_uuid_state *s, pd_uuid_t *uuid, pd_uuid_t *ns, voi
 }
 
 /*
- * s must point to enough space
+ * s must point to enough space, i.e. at least 37 bytes.
+ * this is constrained enough that sprintf could
+ * probably be avoided
  */
 char *pd_uuid_get_string(pd_uuid_t *uuid, char *s) {
        char *r;
@@ -508,6 +510,11 @@ char *pd_uuid_get_string(pd_uuid_t *uuid, char *s) {
        return s;
 }
 
+/*
+ * might be faster to sscanf in four bytes at a time
+ * and using htonl()
+ * A nybble loop might be faster yet.
+ */
 int pd_uuid_set_string(pd_uuid_t *uuid, char *s) {
        unsigned int byte;
        int i;
index e17b7e927621dbf67b1ba2a9140c27e173173340..eefae3b6b6b4d4c10ac6e1feace8ab56ce802456 100644 (file)
@@ -144,9 +144,9 @@ int main(int ac, char *av[]) {
        str_ok(&uuid, "622e4fa5-7481-57ed-9c91-19e1ba69bf88", "set from hash");
 
        pd_uuid_make_v3(0, &uuid, &pd_uuid_ns_dns, "www.widgets.com", strlen("www.widgets.com"));
-       str_ok(&uuid, "3d813cbb-47fb-32ba-91df-831e1593ac29", "md5 dns");
+       str_ok(&uuid, "3d813cbb-47fb-32ba-91df-831e1593ac29", "md5 widgets dns");
        pd_uuid_make_v5(0, &uuid, &pd_uuid_ns_dns, "www.widgets.com", strlen("www.widgets.com"));
-       str_ok(&uuid, "21f7f8de-8051-5b89-8680-0195ef798b6a", "md5 dns");
+       str_ok(&uuid, "21f7f8de-8051-5b89-8680-0195ef798b6a", "sha widgets dns");
 
        pd_uuid_rng_get_bytes(hash, 5);