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 f7711d8386ce35a6ed83ff063f9b7867cedd389a..c7808c43a193c55854ad52fc90401e4b5ec6e9c3 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 daedaf520bf081a6979579467741346ab3159260..dd1e2df40c7e92af3183c164b12d708f15dcf540 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 50a264668f189dfa1708d3ebb8d22bd1deebf14b..b6d307c40bbf47b1d45e163f260b7d754798c27c 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 22172a950d15921cd603240b12d7623e5c7eaa5f..8869d43ffb1a0147f044afed664a45928e2cc619 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