Mesa (master): util/sha1: harmonize _mesa_sha1_* wrappers

Emil Velikov evelikov at kemper.freedesktop.org
Wed Mar 22 11:39:10 UTC 2017


Module: Mesa
Branch: master
Commit: 10d3702a3647842e66433d8b51557cba8b01e7e1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=10d3702a3647842e66433d8b51557cba8b01e7e1

Author: Grazvydas Ignotas <notasas at gmail.com>
Date:   Wed Mar 22 01:43:34 2017 +0200

util/sha1: harmonize _mesa_sha1_* wrappers

Rather than using 3 different ways to wrap _mesa_sha1_*() to SHA1*()
functions (a macro, prototype with implementation in .c and an inline
function), make all 3 inline functions.

Signed-off-by: Grazvydas Ignotas <notasas at gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>

---

 src/util/mesa-sha1.c |  6 ------
 src/util/mesa-sha1.h | 13 ++++++++++---
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/util/mesa-sha1.c b/src/util/mesa-sha1.c
index a14fec97e7..fa9284627b 100644
--- a/src/util/mesa-sha1.c
+++ b/src/util/mesa-sha1.c
@@ -28,12 +28,6 @@
 #include "mesa-sha1.h"
 
 void
-_mesa_sha1_update(struct mesa_sha1 *ctx, const void *data, int size)
-{
-   SHA1Update(ctx, data, size);
-}
-
-void
 _mesa_sha1_compute(const void *data, size_t size, unsigned char result[20])
 {
    struct mesa_sha1 ctx;
diff --git a/src/util/mesa-sha1.h b/src/util/mesa-sha1.h
index ecbc708b5e..a81aba96e9 100644
--- a/src/util/mesa-sha1.h
+++ b/src/util/mesa-sha1.h
@@ -32,10 +32,17 @@ extern "C" {
 
 #define mesa_sha1 _SHA1_CTX
 
-#define _mesa_sha1_init SHA1Init
+static inline void
+_mesa_sha1_init(struct mesa_sha1 *ctx)
+{
+   SHA1Init(ctx);
+}
 
-void
-_mesa_sha1_update(struct mesa_sha1 *ctx, const void *data, int size);
+static inline void
+_mesa_sha1_update(struct mesa_sha1 *ctx, const void *data, size_t size)
+{
+   SHA1Update(ctx, (const unsigned char *)data, size);
+}
 
 static inline void
 _mesa_sha1_final(struct mesa_sha1 *ctx, unsigned char result[20])




More information about the mesa-commit mailing list