util/sha1: harmonize _mesa_sha1_* wrappers
authorGrazvydas Ignotas <notasas@gmail.com>
Tue, 21 Mar 2017 23:43:34 +0000 (01:43 +0200)
committerEmil Velikov <emil.l.velikov@gmail.com>
Wed, 22 Mar 2017 11:33:51 +0000 (11:33 +0000)
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@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
src/util/mesa-sha1.c
src/util/mesa-sha1.h

index a14fec9..fa92846 100644 (file)
 #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;
index ecbc708..a81aba9 100644 (file)
@@ -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])