diff mbox series

[1/3] sha256: avoid redefinition for MIN

Message ID 20181022053605.81048-2-carenas@gmail.com (mailing list archive)
State New, archived
Headers show
Series refactor MIN macro | expand

Commit Message

Carlo Marcelo Arenas Belón Oct. 22, 2018, 5:36 a.m. UTC
it is already defined whenever "sys/param.h" is available

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
 sha256/block/sha256.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Junio C Hamano Oct. 22, 2018, 6 a.m. UTC | #1
Carlo Marcelo Arenas Belón  <carenas@gmail.com> writes:

> it is already defined whenever "sys/param.h" is available
>
> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
> ---
>  sha256/block/sha256.c | 2 ++
>  1 file changed, 2 insertions(+)

It is a no-brainer to say that this is obviously good.  I'd rather
see this become a part of sha256 topic (perhaps squash it in to
eliminate the need to have it as a separate patch), though.

Thanks.

>
> diff --git a/sha256/block/sha256.c b/sha256/block/sha256.c
> index 18350c161a..0d4939cc2c 100644
> --- a/sha256/block/sha256.c
> +++ b/sha256/block/sha256.c
> @@ -130,7 +130,9 @@ static void blk_SHA256_Transform(blk_SHA256_CTX *ctx, const unsigned char *buf)
>  	}
>  }
>  
> +#ifndef MIN
>  #define MIN(x, y) ((x) < (y) ? (x) : (y))
> +#endif
>  void blk_SHA256_Update(blk_SHA256_CTX *ctx, const void *data, size_t len)
>  {
>  	const unsigned char *in = data;
diff mbox series

Patch

diff --git a/sha256/block/sha256.c b/sha256/block/sha256.c
index 18350c161a..0d4939cc2c 100644
--- a/sha256/block/sha256.c
+++ b/sha256/block/sha256.c
@@ -130,7 +130,9 @@  static void blk_SHA256_Transform(blk_SHA256_CTX *ctx, const unsigned char *buf)
 	}
 }
 
+#ifndef MIN
 #define MIN(x, y) ((x) < (y) ? (x) : (y))
+#endif
 void blk_SHA256_Update(blk_SHA256_CTX *ctx, const void *data, size_t len)
 {
 	const unsigned char *in = data;