Prefer "sizeof v" over the equivalent "4".
authorJim Meyering <meyering@redhat.com>
Thu, 31 Jan 2008 12:04:07 +0000 (13:04 +0100)
committerJim Meyering <meyering@redhat.com>
Thu, 31 Jan 2008 12:14:09 +0000 (13:14 +0100)
* lib/md4.c (set_uint32): Use "sizeof v" as memcpy length, not 4.
* lib/md5.c (set_uint32): Likewise.
* lib/sha1.c (set_uint32): Likewise.

ChangeLog
lib/md4.c
lib/md5.c
lib/sha1.c

index f7711d8..c7808c4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-01-31  Jim Meyering  <meyering@redhat.com>
+
+       Prefer "sizeof v" over the equivalent "4".
+       * lib/md4.c (set_uint32): Use "sizeof v" as memcpy length, not 4.
+       * lib/md5.c (set_uint32): Likewise.
+       * lib/sha1.c (set_uint32): Likewise.
+
 2008-01-31  Simon Josefsson  <simon@josefsson.org>
 
        * lib/sha1.c (set_uint32): Mark function as static.
index daedaf5..dd1e2df 100644 (file)
--- a/lib/md4.c
+++ b/lib/md4.c
@@ -70,7 +70,7 @@ md4_init_ctx (struct md4_ctx *ctx)
 static void
 set_uint32 (char *cp, uint32_t v)
 {
-  memcpy (cp, &v, 4);
+  memcpy (cp, &v, sizeof v);
 }
 
 /* Put result from CTX in first 16 bytes following RESBUF.  The result
index 50a2646..b6d307c 100644 (file)
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -86,7 +86,7 @@ md5_init_ctx (struct md5_ctx *ctx)
 static void
 set_uint32 (char *cp, uint32_t v)
 {
-  memcpy (cp, &v, 4);
+  memcpy (cp, &v, sizeof v);
 }
 
 /* Put result from CTX in first 16 bytes following RESBUF.  The result
index 22172a9..8869d43 100644 (file)
@@ -73,7 +73,7 @@ sha1_init_ctx (struct sha1_ctx *ctx)
 static void
 set_uint32 (char *cp, uint32_t v)
 {
-  memcpy (cp, &v, 4);
+  memcpy (cp, &v, sizeof v);
 }
 
 /* Put result from CTX in first 20 bytes following RESBUF.  The result