From 6dd170e5a42704b383839d744b49531ac1a768ff Mon Sep 17 00:00:00 2001 From: Mihai Preda Date: Mon, 14 Nov 2022 19:58:13 +0200 Subject: [PATCH] util: minor refactor _mesa_sha1_print() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit should not change the output; avoids an additional printf() for the separator. Reviewed-by: Marek Olšák Acked-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/util/mesa-sha1.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/util/mesa-sha1.c b/src/util/mesa-sha1.c index 701ba8a28b6..bdca1233a02 100644 --- a/src/util/mesa-sha1.c +++ b/src/util/mesa-sha1.c @@ -27,6 +27,7 @@ #include "sha1/sha1.h" #include "mesa-sha1.h" #include +#include void _mesa_sha1_compute(const void *data, size_t size, unsigned char result[20]) @@ -83,9 +84,7 @@ _mesa_sha1_print(FILE *f, const uint8_t sha1[SHA1_DIGEST_LENGTH]) sha1_to_uint32(sha1, u32); for (unsigned i = 0; i < SHA1_DIGEST_LENGTH32; i++) { - fprintf(f, "0x%08x", u32[i]); - if (i < SHA1_DIGEST_LENGTH32 - 1) - fprintf(f, ", "); + fprintf(f, i ? ", 0x%08" PRIx32 : "0x%08" PRIx32, u32[i]); } }