From 0fd61fb639f7704c4faa8c7fd262af32b3a1a01b Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Tue, 24 Jan 2017 21:21:10 +0000 Subject: [PATCH] util/sha1: drop _mesa_sha1_{update, format} return type Unused/unchecked by any of the callers. v2: Fix the glsl cases that have crept in since v1 Signed-off-by: Emil Velikov Reviewed-by: Grazvydas Ignotas --- src/compiler/glsl/glsl_parser_extras.cpp | 4 ++-- src/compiler/glsl/shader_cache.cpp | 15 ++++++++------- src/util/mesa-sha1.c | 7 ++----- src/util/mesa-sha1.h | 4 ++-- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index 776636c03c9..48cbc01ba74 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -1943,8 +1943,8 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader, if (ctx->Cache && disk_cache_has_key(ctx->Cache, shader->sha1)) { /* We've seen this shader before and know it compiles */ if (ctx->_Shader->Flags & GLSL_CACHE_INFO) { - fprintf(stderr, "deferring compile of shader: %s\n", - _mesa_sha1_format(buf, shader->sha1)); + _mesa_sha1_format(buf, shader->sha1); + fprintf(stderr, "deferring compile of shader: %s\n", buf); } shader->CompileStatus = compile_skipped; diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp index 7d8d63ba9e7..4b314d59b0e 100644 --- a/src/compiler/glsl/shader_cache.cpp +++ b/src/compiler/glsl/shader_cache.cpp @@ -1265,8 +1265,8 @@ shader_cache_write_program_metadata(struct gl_context *ctx, for (unsigned i = 0; i < prog->NumShaders; i++) { disk_cache_put_key(cache, prog->Shaders[i]->sha1); if (ctx->_Shader->Flags & GLSL_CACHE_INFO) { - fprintf(stderr, "marking shader: %s\n", - _mesa_sha1_format(sha1_buf, prog->Shaders[i]->sha1)); + _mesa_sha1_format(sha1_buf, prog->Shaders[i]->sha1); + fprintf(stderr, "marking shader: %s\n", sha1_buf); } } @@ -1275,8 +1275,8 @@ shader_cache_write_program_metadata(struct gl_context *ctx, free(metadata); if (ctx->_Shader->Flags & GLSL_CACHE_INFO) { - fprintf(stderr, "putting program metadata in cache: %s\n", - _mesa_sha1_format(sha1_buf, prog->data->sha1)); + _mesa_sha1_format(sha1_buf, prog->data->sha1); + fprintf(stderr, "putting program metadata in cache: %s\n", sha1_buf); } } @@ -1327,9 +1327,9 @@ shader_cache_read_program_metadata(struct gl_context *ctx, for (unsigned i = 0; i < prog->NumShaders; i++) { struct gl_shader *sh = prog->Shaders[i]; + _mesa_sha1_format(sha1buf, sh->sha1); ralloc_asprintf_append(&buf, "%s: %s\n", - _mesa_shader_stage_to_abbrev(sh->Stage), - _mesa_sha1_format(sha1buf, sh->sha1)); + _mesa_shader_stage_to_abbrev(sh->Stage), sha1buf); } _mesa_sha1_compute(buf, strlen(buf), prog->data->sha1); ralloc_free(buf); @@ -1353,8 +1353,9 @@ shader_cache_read_program_metadata(struct gl_context *ctx, } if (ctx->_Shader->Flags & GLSL_CACHE_INFO) { + _mesa_sha1_format(sha1buf, prog->data->sha1); fprintf(stderr, "loading shader program meta data from cache: %s\n", - _mesa_sha1_format(sha1buf, prog->data->sha1)); + sha1buf); } struct blob_reader metadata; diff --git a/src/util/mesa-sha1.c b/src/util/mesa-sha1.c index eb882e8bd00..a14fec97e7c 100644 --- a/src/util/mesa-sha1.c +++ b/src/util/mesa-sha1.c @@ -27,11 +27,10 @@ #include "sha1/sha1.h" #include "mesa-sha1.h" -int +void _mesa_sha1_update(struct mesa_sha1 *ctx, const void *data, int size) { SHA1Update(ctx, data, size); - return 1; } void @@ -44,7 +43,7 @@ _mesa_sha1_compute(const void *data, size_t size, unsigned char result[20]) _mesa_sha1_final(&ctx, result); } -char * +void _mesa_sha1_format(char *buf, const unsigned char *sha1) { static const char hex_digits[] = "0123456789abcdef"; @@ -55,6 +54,4 @@ _mesa_sha1_format(char *buf, const unsigned char *sha1) buf[i + 1] = hex_digits[sha1[i >> 1] & 0x0f]; } buf[i] = '\0'; - - return buf; } diff --git a/src/util/mesa-sha1.h b/src/util/mesa-sha1.h index f927d5772db..ecbc708b5ea 100644 --- a/src/util/mesa-sha1.h +++ b/src/util/mesa-sha1.h @@ -34,7 +34,7 @@ extern "C" { #define _mesa_sha1_init SHA1Init -int +void _mesa_sha1_update(struct mesa_sha1 *ctx, const void *data, int size); static inline void @@ -43,7 +43,7 @@ _mesa_sha1_final(struct mesa_sha1 *ctx, unsigned char result[20]) SHA1Final(result, ctx); } -char * +void _mesa_sha1_format(char *buf, const unsigned char *sha1); void -- 2.30.2