Merge pull request #5026 from tenderlove/define-hash-global-init-consnstently Each hash implementation should define `git_hash_global_init`
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
diff --git a/src/hash.h b/src/hash.h
index 0502e35..bd3e3b5 100644
--- a/src/hash.h
+++ b/src/hash.h
@@ -31,8 +31,6 @@ void git_hash_ctx_cleanup(git_hash_ctx *ctx);
# include "hash/hash_generic.h"
#endif
-int git_hash_global_init(void);
-
typedef struct {
void *data;
size_t len;
diff --git a/src/hash/hash_win32.c b/src/hash/hash_win32.c
index 4b68303..792298f 100644
--- a/src/hash/hash_win32.c
+++ b/src/hash/hash_win32.c
@@ -109,21 +109,6 @@ static void git_hash_global_shutdown(void)
hash_cryptoapi_prov_shutdown();
}
-int git_hash_global_init(void)
-{
- int error = 0;
-
- if (hash_prov.type != INVALID)
- return 0;
-
- if ((error = hash_cng_prov_init()) < 0)
- error = hash_cryptoapi_prov_init();
-
- git__on_shutdown(git_hash_global_shutdown);
-
- return error;
-}
-
/* CryptoAPI: available in Windows XP and newer */
GIT_INLINE(int) hash_ctx_cryptoapi_init(git_hash_ctx *ctx)
diff --git a/src/hash/hash_win32.h b/src/hash/hash_win32.h
index 9704204..6cddcaa 100644
--- a/src/hash/hash_win32.h
+++ b/src/hash/hash_win32.h
@@ -138,4 +138,19 @@ struct git_hash_ctx {
} ctx;
};
+GIT_INLINE(int) git_hash_global_init(void)
+{
+ int error = 0;
+
+ if (hash_prov.type != INVALID)
+ return 0;
+
+ if ((error = hash_cng_prov_init()) < 0)
+ error = hash_cryptoapi_prov_init();
+
+ git__on_shutdown(git_hash_global_shutdown);
+
+ return error;
+}
+
#endif