[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libmicrohttpd] 02/06: MD5: replaced needless checks with a
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libmicrohttpd] 02/06: MD5: replaced needless checks with asserts |
Date: |
Tue, 16 Apr 2019 09:59:47 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 41db082e8acc77ae4946aef8ab7343f4c925ce48
Author: Evgeny Grin (Karlson2k) <address@hidden>
AuthorDate: Mon Apr 15 22:14:06 2019 +0300
MD5: replaced needless checks with asserts
---
src/microhttpd/md5.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/src/microhttpd/md5.c b/src/microhttpd/md5.c
index 6a8819c9..4d747c18 100644
--- a/src/microhttpd/md5.c
+++ b/src/microhttpd/md5.c
@@ -19,6 +19,7 @@
#include "md5.h"
#include "mhd_byteorder.h"
+#include "mhd_assert.h"
#define PUT_64BIT_LE(cp, value) do { \
(cp)[7] = (uint8_t)((value) >> 56); \
@@ -54,8 +55,7 @@ MD5Init (void *ctx_)
{
struct MD5Context *ctx = ctx_;
- if (!ctx)
- return;
+ mhd_assert (ctx != NULL);
ctx->count = 0;
ctx->state[0] = 0x67452301;
ctx->state[1] = 0xefcdab89;
@@ -74,8 +74,7 @@ MD5Pad (struct MD5Context *ctx)
uint8_t count[8];
size_t padlen;
- if (!ctx)
- return;
+ mhd_assert (ctx != NULL);
/* Convert count to 8 bytes in little endian order. */
PUT_64BIT_LE(count, ctx->count);
@@ -102,8 +101,8 @@ MD5Final (void *ctx_,
struct MD5Context *ctx = ctx_;
int i;
- if (!ctx || !digest)
- return;
+ mhd_assert (ctx != NULL);
+ mhd_assert (digest != NULL);
MD5Pad(ctx);
for (i = 0; i < 4; i++)
@@ -241,8 +240,8 @@ MD5Update (void *ctx_,
struct MD5Context *ctx = ctx_;
size_t have, need;
- if (!ctx || !input)
- return;
+ mhd_assert (ctx != NULL);
+ mhd_assert ((ctx != NULL) || (len == 0));
/* Check how many bytes we already have and how many more we need. */
have = (size_t)((ctx->count >> 3) & (MD5_BLOCK_SIZE - 1));
@@ -282,5 +281,4 @@ MD5Update (void *ctx_,
}
-
/* end of md5.c */
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [libmicrohttpd] branch master updated (1917b866 -> 7ce09bd9), gnunet, 2019/04/16
- [GNUnet-SVN] [libmicrohttpd] 01/06: test_md5: added tests for md5 calculations, gnunet, 2019/04/16
- [GNUnet-SVN] [libmicrohttpd] 03/06: MD5: fixed declaration, gnunet, 2019/04/16
- [GNUnet-SVN] [libmicrohttpd] 02/06: MD5: replaced needless checks with asserts,
gnunet <=
- [GNUnet-SVN] [libmicrohttpd] 05/06: MD5: some optimisations for little-endian, gnunet, 2019/04/16
- [GNUnet-SVN] [libmicrohttpd] 06/06: MD5: optimisation and simplification, gnunet, 2019/04/16
- [GNUnet-SVN] [libmicrohttpd] 04/06: MD5: count bytes, not bits MHD do not add bites, no need to count more precise than bytes, gnunet, 2019/04/16