Consistent naming between compressor/hash types - dedup - deduplicating backup program HTML git clone git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit d28e04853298face6e9a03a8c2b76bffcb394b32 DIR parent f07513053f8662fac3f909bb6e2cdf895b567cb3 HTML Author: sin <sin@2f30.org> Date: Sun, 7 Apr 2019 13:26:44 +0100 Consistent naming between compressor/hash types Diffstat: M dedup.h | 6 +++--- M hash.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) --- DIR diff --git a/dedup.h b/dedup.h @@ -34,9 +34,9 @@ enum compr_algo { }; enum hash_algo { - BLAKE2B_ALGO, - BLAKE2BP_ALGO, - NR_HASH_ALGOS, + HASH_BLAKE2B, + HASH_BLAKE2BP, + NR_HASHES, }; struct chunker; DIR diff --git a/hash.c b/hash.c @@ -17,7 +17,7 @@ static struct hash_ops { int (*init)(struct hash_ctx *ctx, size_t n); int (*update)(struct hash_ctx *ctx, const void *buf, size_t n); int (*final)(struct hash_ctx *ctx, void *buf, size_t n); -} hashes[NR_HASH_ALGOS] = { +} hashes[NR_HASHES] = { { .init = blake2bi, .update = blake2bu, @@ -36,11 +36,11 @@ static struct algomap { } algomap[] = { { .name = "blake2b", - .type = BLAKE2B_ALGO, + .type = HASH_BLAKE2B, }, { .name = "blake2bp", - .type = BLAKE2BP_ALGO, + .type = HASH_BLAKE2BP, }, { .name = NULL, @@ -86,7 +86,7 @@ blake2bpf(struct hash_ctx *ctx, void *buf, size_t n) int hash_init(struct hash_ctx *ctx, int type, size_t n) { - if (type < 0 || type >= NR_HASH_ALGOS) + if (type < 0 || type >= NR_HASHES) return -1; ctx->ops = &hashes[type];