mirror of
https://github.com/libgit2/libgit2.git
synced 2026-01-25 02:56:17 +00:00
c90/c99: name the unnamed union in git_hash_ctx
This commit is contained in:
10
src/hash.c
10
src/hash.c
@@ -16,7 +16,7 @@ int git_hash_ctx_init(git_hash_ctx *ctx)
|
||||
{
|
||||
int error;
|
||||
|
||||
if ((error = git_hash_sha1_ctx_init(&ctx->sha1)) < 0)
|
||||
if ((error = git_hash_sha1_ctx_init(&ctx->ctx.sha1)) < 0)
|
||||
return error;
|
||||
|
||||
ctx->algo = GIT_HASH_ALGO_SHA1;
|
||||
@@ -28,7 +28,7 @@ void git_hash_ctx_cleanup(git_hash_ctx *ctx)
|
||||
{
|
||||
switch (ctx->algo) {
|
||||
case GIT_HASH_ALGO_SHA1:
|
||||
git_hash_sha1_ctx_cleanup(&ctx->sha1);
|
||||
git_hash_sha1_ctx_cleanup(&ctx->ctx.sha1);
|
||||
return;
|
||||
default:
|
||||
/* unreachable */ ;
|
||||
@@ -39,7 +39,7 @@ int git_hash_init(git_hash_ctx *ctx)
|
||||
{
|
||||
switch (ctx->algo) {
|
||||
case GIT_HASH_ALGO_SHA1:
|
||||
return git_hash_sha1_init(&ctx->sha1);
|
||||
return git_hash_sha1_init(&ctx->ctx.sha1);
|
||||
default:
|
||||
/* unreachable */ ;
|
||||
}
|
||||
@@ -51,7 +51,7 @@ int git_hash_update(git_hash_ctx *ctx, const void *data, size_t len)
|
||||
{
|
||||
switch (ctx->algo) {
|
||||
case GIT_HASH_ALGO_SHA1:
|
||||
return git_hash_sha1_update(&ctx->sha1, data, len);
|
||||
return git_hash_sha1_update(&ctx->ctx.sha1, data, len);
|
||||
default:
|
||||
/* unreachable */ ;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ int git_hash_final(git_oid *out, git_hash_ctx *ctx)
|
||||
{
|
||||
switch (ctx->algo) {
|
||||
case GIT_HASH_ALGO_SHA1:
|
||||
return git_hash_sha1_final(out, &ctx->sha1);
|
||||
return git_hash_sha1_final(out, &ctx->ctx.sha1);
|
||||
default:
|
||||
/* unreachable */ ;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ typedef enum {
|
||||
typedef struct git_hash_ctx {
|
||||
union {
|
||||
git_hash_sha1_ctx sha1;
|
||||
};
|
||||
} ctx;
|
||||
git_hash_algo_t algo;
|
||||
} git_hash_ctx;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user