Commit 3fff5970 by Edward Thomson

hash: don't abbreviate algorithm

parent b7bad55e
...@@ -19,15 +19,15 @@ int git_hash_ctx_init(git_hash_ctx *ctx) ...@@ -19,15 +19,15 @@ int git_hash_ctx_init(git_hash_ctx *ctx)
if ((error = git_hash_sha1_ctx_init(&ctx->ctx.sha1)) < 0) if ((error = git_hash_sha1_ctx_init(&ctx->ctx.sha1)) < 0)
return error; return error;
ctx->algo = GIT_HASH_ALGO_SHA1; ctx->algorithm = GIT_HASH_ALGORITHM_SHA1;
return 0; return 0;
} }
void git_hash_ctx_cleanup(git_hash_ctx *ctx) void git_hash_ctx_cleanup(git_hash_ctx *ctx)
{ {
switch (ctx->algo) { switch (ctx->algorithm) {
case GIT_HASH_ALGO_SHA1: case GIT_HASH_ALGORITHM_SHA1:
git_hash_sha1_ctx_cleanup(&ctx->ctx.sha1); git_hash_sha1_ctx_cleanup(&ctx->ctx.sha1);
return; return;
default: default:
...@@ -37,8 +37,8 @@ void git_hash_ctx_cleanup(git_hash_ctx *ctx) ...@@ -37,8 +37,8 @@ void git_hash_ctx_cleanup(git_hash_ctx *ctx)
int git_hash_init(git_hash_ctx *ctx) int git_hash_init(git_hash_ctx *ctx)
{ {
switch (ctx->algo) { switch (ctx->algorithm) {
case GIT_HASH_ALGO_SHA1: case GIT_HASH_ALGORITHM_SHA1:
return git_hash_sha1_init(&ctx->ctx.sha1); return git_hash_sha1_init(&ctx->ctx.sha1);
default: default:
/* unreachable */ ; /* unreachable */ ;
...@@ -49,8 +49,8 @@ int git_hash_init(git_hash_ctx *ctx) ...@@ -49,8 +49,8 @@ int git_hash_init(git_hash_ctx *ctx)
int git_hash_update(git_hash_ctx *ctx, const void *data, size_t len) int git_hash_update(git_hash_ctx *ctx, const void *data, size_t len)
{ {
switch (ctx->algo) { switch (ctx->algorithm) {
case GIT_HASH_ALGO_SHA1: case GIT_HASH_ALGORITHM_SHA1:
return git_hash_sha1_update(&ctx->ctx.sha1, data, len); return git_hash_sha1_update(&ctx->ctx.sha1, data, len);
default: default:
/* unreachable */ ; /* unreachable */ ;
...@@ -61,8 +61,8 @@ int git_hash_update(git_hash_ctx *ctx, const void *data, size_t len) ...@@ -61,8 +61,8 @@ int git_hash_update(git_hash_ctx *ctx, const void *data, size_t len)
int git_hash_final(git_oid *out, git_hash_ctx *ctx) int git_hash_final(git_oid *out, git_hash_ctx *ctx)
{ {
switch (ctx->algo) { switch (ctx->algorithm) {
case GIT_HASH_ALGO_SHA1: case GIT_HASH_ALGORITHM_SHA1:
return git_hash_sha1_final(out, &ctx->ctx.sha1); return git_hash_sha1_final(out, &ctx->ctx.sha1);
default: default:
/* unreachable */ ; /* unreachable */ ;
......
...@@ -18,9 +18,9 @@ typedef struct { ...@@ -18,9 +18,9 @@ typedef struct {
} git_buf_vec; } git_buf_vec;
typedef enum { typedef enum {
GIT_HASH_ALGO_UNKNOWN = 0, GIT_HASH_ALGORITHM_NONE = 0,
GIT_HASH_ALGO_SHA1, GIT_HASH_ALGORITHM_SHA1
} git_hash_algo_t; } git_hash_algorithm_t;
#include "hash/sha1.h" #include "hash/sha1.h"
...@@ -28,7 +28,7 @@ typedef struct git_hash_ctx { ...@@ -28,7 +28,7 @@ typedef struct git_hash_ctx {
union { union {
git_hash_sha1_ctx sha1; git_hash_sha1_ctx sha1;
} ctx; } ctx;
git_hash_algo_t algo; git_hash_algorithm_t algorithm;
} git_hash_ctx; } git_hash_ctx;
int git_hash_global_init(void); int git_hash_global_init(void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment