]> git.ipfire.org Git - thirdparty/git.git/commitdiff
sha256/gcrypt: fix build with SANITIZE=leak
authorEric Wong <e@80x24.org>
Mon, 31 Jul 2023 12:08:06 +0000 (12:08 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 31 Jul 2023 15:56:54 +0000 (08:56 -0700)
Non-static functions cause `undefined reference' errors when
building with `SANITIZE=leak' due to the lack of prototypes.
Mark all these functions as `static inline' as we do in
sha256/nettle.h to avoid the need to maintain prototypes.

Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha256/gcrypt.h

index 501da5ed9197ec61497e244879c7f60ba58617c1..68cf6b6a546a7117385bf763a4ab11838a0e7a6d 100644 (file)
@@ -7,22 +7,22 @@
 
 typedef gcry_md_hd_t gcrypt_SHA256_CTX;
 
-inline void gcrypt_SHA256_Init(gcrypt_SHA256_CTX *ctx)
+static inline void gcrypt_SHA256_Init(gcrypt_SHA256_CTX *ctx)
 {
        gcry_md_open(ctx, GCRY_MD_SHA256, 0);
 }
 
-inline void gcrypt_SHA256_Update(gcrypt_SHA256_CTX *ctx, const void *data, size_t len)
+static inline void gcrypt_SHA256_Update(gcrypt_SHA256_CTX *ctx, const void *data, size_t len)
 {
        gcry_md_write(*ctx, data, len);
 }
 
-inline void gcrypt_SHA256_Final(unsigned char *digest, gcrypt_SHA256_CTX *ctx)
+static inline void gcrypt_SHA256_Final(unsigned char *digest, gcrypt_SHA256_CTX *ctx)
 {
        memcpy(digest, gcry_md_read(*ctx, GCRY_MD_SHA256), SHA256_DIGEST_SIZE);
 }
 
-inline void gcrypt_SHA256_Clone(gcrypt_SHA256_CTX *dst, const gcrypt_SHA256_CTX *src)
+static inline void gcrypt_SHA256_Clone(gcrypt_SHA256_CTX *dst, const gcrypt_SHA256_CTX *src)
 {
        gcry_md_copy(dst, *src);
 }