Skip to content

Commit 7f1ba19

Browse files
authored
Merge pull request libgit2#5026 from tenderlove/define-hash-global-init-consnstently
Each hash implementation should define `git_hash_global_init`
2 parents 8e4927a + be9a386 commit 7f1ba19

File tree

3 files changed

+15
-17
lines changed

3 files changed

+15
-17
lines changed

src/hash.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ void git_hash_ctx_cleanup(git_hash_ctx *ctx);
3131
# include "hash/hash_generic.h"
3232
#endif
3333

34-
int git_hash_global_init(void);
35-
3634
typedef struct {
3735
void *data;
3836
size_t len;

src/hash/hash_win32.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -109,21 +109,6 @@ static void git_hash_global_shutdown(void)
109109
hash_cryptoapi_prov_shutdown();
110110
}
111111

112-
int git_hash_global_init(void)
113-
{
114-
int error = 0;
115-
116-
if (hash_prov.type != INVALID)
117-
return 0;
118-
119-
if ((error = hash_cng_prov_init()) < 0)
120-
error = hash_cryptoapi_prov_init();
121-
122-
git__on_shutdown(git_hash_global_shutdown);
123-
124-
return error;
125-
}
126-
127112
/* CryptoAPI: available in Windows XP and newer */
128113

129114
GIT_INLINE(int) hash_ctx_cryptoapi_init(git_hash_ctx *ctx)

src/hash/hash_win32.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,19 @@ struct git_hash_ctx {
138138
} ctx;
139139
};
140140

141+
GIT_INLINE(int) git_hash_global_init(void)
142+
{
143+
int error = 0;
144+
145+
if (hash_prov.type != INVALID)
146+
return 0;
147+
148+
if ((error = hash_cng_prov_init()) < 0)
149+
error = hash_cryptoapi_prov_init();
150+
151+
git__on_shutdown(git_hash_global_shutdown);
152+
153+
return error;
154+
}
155+
141156
#endif

0 commit comments

Comments
 (0)