mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-09 18:22:16 +00:00
Merge pull request #1363 from schu/hash-initialization
hash: remove git_hash_init from internal api
This commit is contained in:
commit
f657688bc7
@ -31,7 +31,6 @@ typedef struct {
|
||||
size_t len;
|
||||
} git_buf_vec;
|
||||
|
||||
int git_hash_init(git_hash_ctx *c);
|
||||
int git_hash_update(git_hash_ctx *c, const void *data, size_t len);
|
||||
int git_hash_final(git_oid *out, git_hash_ctx *c);
|
||||
|
||||
|
@ -221,7 +221,7 @@ static void hash__block(git_hash_ctx *ctx, const unsigned int *data)
|
||||
ctx->H[4] += E;
|
||||
}
|
||||
|
||||
int git_hash_init(git_hash_ctx *ctx)
|
||||
int git_hash_ctx_init(git_hash_ctx *ctx)
|
||||
{
|
||||
ctx->size = 0;
|
||||
|
||||
|
@ -18,7 +18,6 @@ struct git_hash_ctx {
|
||||
|
||||
#define git_hash_global_init() 0
|
||||
#define git_hash_global_shutdown() /* noop */
|
||||
#define git_hash_ctx_init(ctx) git_hash_init(ctx)
|
||||
#define git_hash_ctx_cleanup(ctx)
|
||||
|
||||
#endif /* INCLUDE_hash_generic_h__ */
|
||||
|
@ -134,7 +134,7 @@ GIT_INLINE(int) hash_ctx_cryptoapi_init(git_hash_ctx *ctx)
|
||||
ctx->type = CRYPTOAPI;
|
||||
ctx->prov = &hash_prov;
|
||||
|
||||
return git_hash_init(ctx);
|
||||
return git_hash_ctx_init(ctx);
|
||||
}
|
||||
|
||||
GIT_INLINE(int) hash_cryptoapi_init(git_hash_ctx *ctx)
|
||||
@ -262,7 +262,7 @@ int git_hash_ctx_init(git_hash_ctx *ctx)
|
||||
return (hash_prov.type == CNG) ? hash_ctx_cng_init(ctx) : hash_ctx_cryptoapi_init(ctx);
|
||||
}
|
||||
|
||||
int git_hash_init(git_hash_ctx *ctx)
|
||||
int git_hash_ctx_init(git_hash_ctx *ctx)
|
||||
{
|
||||
assert(ctx && ctx->type);
|
||||
return (ctx->type == CNG) ? hash_cng_init(ctx) : hash_cryptoapi_init(ctx);
|
||||
|
@ -35,7 +35,7 @@ void test_object_raw_hash__hash_by_blocks(void)
|
||||
cl_assert(git_oid_cmp(&id1, &id2) == 0);
|
||||
|
||||
/* reinit should permit reuse */
|
||||
cl_git_pass(git_hash_init(&ctx));
|
||||
cl_git_pass(git_hash_ctx_init(&ctx));
|
||||
cl_git_pass(git_hash_update(&ctx, bye_text, strlen(bye_text)));
|
||||
cl_git_pass(git_hash_final(&id2, &ctx));
|
||||
cl_git_pass(git_oid_fromstr(&id1, bye_id));
|
||||
|
Loading…
Reference in New Issue
Block a user