Skip to content

Commit 40f3702

Browse files
committed
c90/c99: name the unnamed union in git_hash_ctx
1 parent 51d69dd commit 40f3702

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/hash.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ int git_hash_ctx_init(git_hash_ctx *ctx)
1616
{
1717
int error;
1818

19-
if ((error = git_hash_sha1_ctx_init(&ctx->sha1)) < 0)
19+
if ((error = git_hash_sha1_ctx_init(&ctx->ctx.sha1)) < 0)
2020
return error;
2121

2222
ctx->algo = GIT_HASH_ALGO_SHA1;
@@ -28,7 +28,7 @@ void git_hash_ctx_cleanup(git_hash_ctx *ctx)
2828
{
2929
switch (ctx->algo) {
3030
case GIT_HASH_ALGO_SHA1:
31-
git_hash_sha1_ctx_cleanup(&ctx->sha1);
31+
git_hash_sha1_ctx_cleanup(&ctx->ctx.sha1);
3232
return;
3333
default:
3434
/* unreachable */ ;
@@ -39,7 +39,7 @@ int git_hash_init(git_hash_ctx *ctx)
3939
{
4040
switch (ctx->algo) {
4141
case GIT_HASH_ALGO_SHA1:
42-
return git_hash_sha1_init(&ctx->sha1);
42+
return git_hash_sha1_init(&ctx->ctx.sha1);
4343
default:
4444
/* unreachable */ ;
4545
}
@@ -51,7 +51,7 @@ int git_hash_update(git_hash_ctx *ctx, const void *data, size_t len)
5151
{
5252
switch (ctx->algo) {
5353
case GIT_HASH_ALGO_SHA1:
54-
return git_hash_sha1_update(&ctx->sha1, data, len);
54+
return git_hash_sha1_update(&ctx->ctx.sha1, data, len);
5555
default:
5656
/* unreachable */ ;
5757
}
@@ -63,7 +63,7 @@ int git_hash_final(git_oid *out, git_hash_ctx *ctx)
6363
{
6464
switch (ctx->algo) {
6565
case GIT_HASH_ALGO_SHA1:
66-
return git_hash_sha1_final(out, &ctx->sha1);
66+
return git_hash_sha1_final(out, &ctx->ctx.sha1);
6767
default:
6868
/* unreachable */ ;
6969
}

src/hash.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ typedef enum {
2727
typedef struct git_hash_ctx {
2828
union {
2929
git_hash_sha1_ctx sha1;
30-
};
30+
} ctx;
3131
git_hash_algo_t algo;
3232
} git_hash_ctx;
3333

0 commit comments

Comments
 (0)