Use "sizeof VAR", rather than a literal "4".
authorJim Meyering <meyering@redhat.com>
Thu, 31 Jan 2008 13:32:19 +0000 (14:32 +0100)
committerJim Meyering <meyering@redhat.com>
Thu, 31 Jan 2008 18:15:59 +0000 (19:15 +0100)
* lib/md5.c (md5_read_ctx): Use sizeof ctx->A, not 4.
* lib/md4.c (md4_read_ctx): Likewise.
* lib/sha1.c (sha1_read_ctx): Likewise.

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

index f3daa369de7a9ce35bcb8d83da169167fb7a6113..8faa77c467a196b3b0fa6c893689745cd1a88f17 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-01-31  Jim Meyering  <meyering@redhat.com>
+
+       Use "sizeof VAR", rather than a literal "4".
+       * lib/md5.c (md5_read_ctx): Use sizeof ctx->A, not 4.
+       * lib/md4.c (md4_read_ctx): Likewise.
+       * lib/sha1.c (sha1_read_ctx): Likewise.
+
 2008-01-31  Simon Josefsson  <simon@josefsson.org>
 
        * tests/test-sha1.c: New file, based on test-md5.c.
index dd1e2df40c7e92af3183c164b12d708f15dcf540..3d2c17a9f2a20ad1665b54f366a533f1e5e5357e 100644 (file)
--- a/lib/md4.c
+++ b/lib/md4.c
@@ -79,10 +79,10 @@ void *
 md4_read_ctx (const struct md4_ctx *ctx, void *resbuf)
 {
   char *r = resbuf;
-  set_uint32 (r + 0*4, SWAP (ctx->A));
-  set_uint32 (r + 1*4, SWAP (ctx->B));
-  set_uint32 (r + 2*4, SWAP (ctx->C));
-  set_uint32 (r + 3*4, SWAP (ctx->D));
+  set_uint32 (r + 0 * sizeof ctx->A, SWAP (ctx->A));
+  set_uint32 (r + 1 * sizeof ctx->B, SWAP (ctx->B));
+  set_uint32 (r + 2 * sizeof ctx->C, SWAP (ctx->C));
+  set_uint32 (r + 3 * sizeof ctx->D, SWAP (ctx->D));
 
   return resbuf;
 }
index b6d307c40bbf47b1d45e163f260b7d754798c27c..0c8bc24dbd56b1c3ebd8bf3b638db8ae8162666a 100644 (file)
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -95,10 +95,10 @@ void *
 md5_read_ctx (const struct md5_ctx *ctx, void *resbuf)
 {
   char *r = resbuf;
-  set_uint32 (r + 0*4, SWAP (ctx->A));
-  set_uint32 (r + 1*4, SWAP (ctx->B));
-  set_uint32 (r + 2*4, SWAP (ctx->C));
-  set_uint32 (r + 3*4, SWAP (ctx->D));
+  set_uint32 (r + 0 * sizeof ctx->A, SWAP (ctx->A));
+  set_uint32 (r + 1 * sizeof ctx->B, SWAP (ctx->B));
+  set_uint32 (r + 2 * sizeof ctx->C, SWAP (ctx->C));
+  set_uint32 (r + 3 * sizeof ctx->D, SWAP (ctx->D));
 
   return resbuf;
 }
index 8869d43ffb1a0147f044afed664a45928e2cc619..a955d85e3fb0400f6dc2ffe73d8fc7b00425f67c 100644 (file)
@@ -82,11 +82,11 @@ void *
 sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf)
 {
   char *r = resbuf;
-  set_uint32 (r + 0*4, SWAP (ctx->A));
-  set_uint32 (r + 1*4, SWAP (ctx->B));
-  set_uint32 (r + 2*4, SWAP (ctx->C));
-  set_uint32 (r + 3*4, SWAP (ctx->D));
-  set_uint32 (r + 4*4, SWAP (ctx->E));
+  set_uint32 (r + 0 * sizeof ctx->A, SWAP (ctx->A));
+  set_uint32 (r + 1 * sizeof ctx->B, SWAP (ctx->B));
+  set_uint32 (r + 2 * sizeof ctx->C, SWAP (ctx->C));
+  set_uint32 (r + 3 * sizeof ctx->D, SWAP (ctx->D));
+  set_uint32 (r + 4 * sizeof ctx->E, SWAP (ctx->E));
 
   return resbuf;
 }