Git fork

hash: stop typedeffing the hash context

We generally avoid using `typedef` in the Git codebase. One exception
though is the `git_hash_ctx`, likely because it used to be a union
rather than a struct until the preceding commit refactored it. But now
that it is a normal `struct` there isn't really a need for a typedef
anymore.

Drop the typedef and adapt all callers accordingly.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Patrick Steinhardt and committed by
Junio C Hamano
7346e340 52eef501

+73 -74
+2 -2
builtin/fast-import.c
··· 953 953 unsigned char hdr[96]; 954 954 struct object_id oid; 955 955 unsigned long hdrlen, deltalen; 956 - git_hash_ctx c; 956 + struct git_hash_ctx c; 957 957 git_zstream s; 958 958 959 959 hdrlen = format_object_header((char *)hdr, sizeof(hdr), type, ··· 1095 1095 struct object_id oid; 1096 1096 unsigned long hdrlen; 1097 1097 off_t offset; 1098 - git_hash_ctx c; 1098 + struct git_hash_ctx c; 1099 1099 git_zstream s; 1100 1100 struct hashfile_checkpoint checkpoint; 1101 1101 int status = Z_OK;
+3 -3
builtin/index-pack.c
··· 151 151 static off_t consumed_bytes; 152 152 static off_t max_input_size; 153 153 static unsigned deepest_delta; 154 - static git_hash_ctx input_ctx; 154 + static struct git_hash_ctx input_ctx; 155 155 static uint32_t input_crc32; 156 156 static int input_fd, output_fd; 157 157 static const char *curr_pack; ··· 475 475 int status; 476 476 git_zstream stream; 477 477 void *buf; 478 - git_hash_ctx c; 478 + struct git_hash_ctx c; 479 479 char hdr[32]; 480 480 int hdrlen; 481 481 ··· 1248 1248 struct ofs_delta_entry *ofs_delta = ofs_deltas; 1249 1249 struct object_id ref_delta_oid; 1250 1250 struct stat st; 1251 - git_hash_ctx tmp_ctx; 1251 + struct git_hash_ctx tmp_ctx; 1252 1252 1253 1253 if (verbose) 1254 1254 progress = start_progress(
+1 -1
builtin/patch-id.c
··· 70 70 int before = -1, after = -1; 71 71 int diff_is_binary = 0; 72 72 char pre_oid_str[GIT_MAX_HEXSZ + 1], post_oid_str[GIT_MAX_HEXSZ + 1]; 73 - git_hash_ctx ctx; 73 + struct git_hash_ctx ctx; 74 74 75 75 the_hash_algo->init_fn(&ctx); 76 76 oidclr(result, the_repository->hash_algo);
+1 -1
builtin/receive-pack.c
··· 566 566 unsigned char k_ipad[GIT_MAX_BLKSZ]; 567 567 unsigned char k_opad[GIT_MAX_BLKSZ]; 568 568 int i; 569 - git_hash_ctx ctx; 569 + struct git_hash_ctx ctx; 570 570 571 571 /* RFC 2104 2. (1) */ 572 572 memset(key, '\0', GIT_MAX_BLKSZ);
+2 -2
builtin/unpack-objects.c
··· 28 28 static unsigned int offset, len; 29 29 static off_t consumed_bytes; 30 30 static off_t max_input_size; 31 - static git_hash_ctx ctx; 31 + static struct git_hash_ctx ctx; 32 32 static struct fsck_options fsck_options = FSCK_OPTIONS_STRICT; 33 33 static struct progress *progress; 34 34 ··· 614 614 { 615 615 int i; 616 616 struct object_id oid; 617 - git_hash_ctx tmp_ctx; 617 + struct git_hash_ctx tmp_ctx; 618 618 619 619 disable_replace_refs(); 620 620
+2 -2
bulk-checkin.c
··· 161 161 * with a new pack. 162 162 */ 163 163 static int stream_blob_to_pack(struct bulk_checkin_packfile *state, 164 - git_hash_ctx *ctx, off_t *already_hashed_to, 164 + struct git_hash_ctx *ctx, off_t *already_hashed_to, 165 165 int fd, size_t size, const char *path, 166 166 unsigned flags) 167 167 { ··· 258 258 const char *path, unsigned flags) 259 259 { 260 260 off_t seekback, already_hashed_to; 261 - git_hash_ctx ctx; 261 + struct git_hash_ctx ctx; 262 262 unsigned char obuf[16384]; 263 263 unsigned header_len; 264 264 struct hashfile_checkpoint checkpoint;
+1 -1
csum-file.c
··· 248 248 int hashfile_checksum_valid(const unsigned char *data, size_t total_len) 249 249 { 250 250 unsigned char got[GIT_MAX_RAWSZ]; 251 - git_hash_ctx ctx; 251 + struct git_hash_ctx ctx; 252 252 const struct git_hash_algo *algop = unsafe_hash_algo(the_hash_algo); 253 253 size_t data_len = total_len - algop->rawsz; 254 254
+2 -2
csum-file.h
··· 11 11 int fd; 12 12 int check_fd; 13 13 unsigned int offset; 14 - git_hash_ctx ctx; 14 + struct git_hash_ctx ctx; 15 15 off_t total; 16 16 struct progress *tp; 17 17 const char *name; ··· 33 33 /* Checkpoint */ 34 34 struct hashfile_checkpoint { 35 35 off_t offset; 36 - git_hash_ctx ctx; 36 + struct git_hash_ctx ctx; 37 37 }; 38 38 39 39 void hashfile_checkpoint_init(struct hashfile *, struct hashfile_checkpoint *);
+5 -5
diff.c
··· 6392 6392 } 6393 6393 6394 6394 struct patch_id_t { 6395 - git_hash_ctx *ctx; 6395 + struct git_hash_ctx *ctx; 6396 6396 int patchlen; 6397 6397 }; 6398 6398 ··· 6409 6409 return dst - line; 6410 6410 } 6411 6411 6412 - void flush_one_hunk(struct object_id *result, git_hash_ctx *ctx) 6412 + void flush_one_hunk(struct object_id *result, struct git_hash_ctx *ctx) 6413 6413 { 6414 6414 unsigned char hash[GIT_MAX_RAWSZ]; 6415 6415 unsigned short carry = 0; ··· 6439 6439 return 0; 6440 6440 } 6441 6441 6442 - static void patch_id_add_string(git_hash_ctx *ctx, const char *str) 6442 + static void patch_id_add_string(struct git_hash_ctx *ctx, const char *str) 6443 6443 { 6444 6444 the_hash_algo->update_fn(ctx, str, strlen(str)); 6445 6445 } 6446 6446 6447 - static void patch_id_add_mode(git_hash_ctx *ctx, unsigned mode) 6447 + static void patch_id_add_mode(struct git_hash_ctx *ctx, unsigned mode) 6448 6448 { 6449 6449 /* large enough for 2^32 in octal */ 6450 6450 char buf[12]; ··· 6457 6457 { 6458 6458 struct diff_queue_struct *q = &diff_queued_diff; 6459 6459 int i; 6460 - git_hash_ctx ctx; 6460 + struct git_hash_ctx ctx; 6461 6461 struct patch_id_t data; 6462 6462 6463 6463 the_hash_algo->init_fn(&ctx);
+1 -1
diff.h
··· 644 644 645 645 int do_diff_cache(const struct object_id *, struct diff_options *); 646 646 int diff_flush_patch_id(struct diff_options *, struct object_id *, int); 647 - void flush_one_hunk(struct object_id *result, git_hash_ctx *ctx); 647 + void flush_one_hunk(struct object_id *result, struct git_hash_ctx *ctx); 648 648 649 649 int diff_result_code(struct rev_info *); 650 650
+5 -6
hash.h
··· 241 241 git_SHA256_CTX sha256; 242 242 } state; 243 243 }; 244 - typedef struct git_hash_ctx git_hash_ctx; 245 244 246 - typedef void (*git_hash_init_fn)(git_hash_ctx *ctx); 247 - typedef void (*git_hash_clone_fn)(git_hash_ctx *dst, const git_hash_ctx *src); 248 - typedef void (*git_hash_update_fn)(git_hash_ctx *ctx, const void *in, size_t len); 249 - typedef void (*git_hash_final_fn)(unsigned char *hash, git_hash_ctx *ctx); 250 - typedef void (*git_hash_final_oid_fn)(struct object_id *oid, git_hash_ctx *ctx); 245 + typedef void (*git_hash_init_fn)(struct git_hash_ctx *ctx); 246 + typedef void (*git_hash_clone_fn)(struct git_hash_ctx *dst, const struct git_hash_ctx *src); 247 + typedef void (*git_hash_update_fn)(struct git_hash_ctx *ctx, const void *in, size_t len); 248 + typedef void (*git_hash_final_fn)(unsigned char *hash, struct git_hash_ctx *ctx); 249 + typedef void (*git_hash_final_oid_fn)(struct object_id *oid, struct git_hash_ctx *ctx); 251 250 252 251 struct git_hash_algo { 253 252 /*
+1 -1
http-push.c
··· 760 760 static void handle_new_lock_ctx(struct xml_ctx *ctx, int tag_closed) 761 761 { 762 762 struct remote_lock *lock = (struct remote_lock *)ctx->userData; 763 - git_hash_ctx hash_ctx; 763 + struct git_hash_ctx hash_ctx; 764 764 unsigned char lock_token_hash[GIT_MAX_RAWSZ]; 765 765 766 766 if (tag_closed && ctx->cdata) {
+1 -1
http.h
··· 228 228 long http_code; 229 229 struct object_id oid; 230 230 struct object_id real_oid; 231 - git_hash_ctx c; 231 + struct git_hash_ctx c; 232 232 git_zstream stream; 233 233 int zret; 234 234 int rename;
+31 -31
object-file.c
··· 86 86 .algo = GIT_HASH_SHA256, 87 87 }; 88 88 89 - static void git_hash_sha1_init(git_hash_ctx *ctx) 89 + static void git_hash_sha1_init(struct git_hash_ctx *ctx) 90 90 { 91 91 git_SHA1_Init(&ctx->state.sha1); 92 92 } 93 93 94 - static void git_hash_sha1_clone(git_hash_ctx *dst, const git_hash_ctx *src) 94 + static void git_hash_sha1_clone(struct git_hash_ctx *dst, const struct git_hash_ctx *src) 95 95 { 96 96 git_SHA1_Clone(&dst->state.sha1, &src->state.sha1); 97 97 } 98 98 99 - static void git_hash_sha1_update(git_hash_ctx *ctx, const void *data, size_t len) 99 + static void git_hash_sha1_update(struct git_hash_ctx *ctx, const void *data, size_t len) 100 100 { 101 101 git_SHA1_Update(&ctx->state.sha1, data, len); 102 102 } 103 103 104 - static void git_hash_sha1_final(unsigned char *hash, git_hash_ctx *ctx) 104 + static void git_hash_sha1_final(unsigned char *hash, struct git_hash_ctx *ctx) 105 105 { 106 106 git_SHA1_Final(hash, &ctx->state.sha1); 107 107 } 108 108 109 - static void git_hash_sha1_final_oid(struct object_id *oid, git_hash_ctx *ctx) 109 + static void git_hash_sha1_final_oid(struct object_id *oid, struct git_hash_ctx *ctx) 110 110 { 111 111 git_SHA1_Final(oid->hash, &ctx->state.sha1); 112 112 memset(oid->hash + GIT_SHA1_RAWSZ, 0, GIT_MAX_RAWSZ - GIT_SHA1_RAWSZ); 113 113 oid->algo = GIT_HASH_SHA1; 114 114 } 115 115 116 - static void git_hash_sha1_init_unsafe(git_hash_ctx *ctx) 116 + static void git_hash_sha1_init_unsafe(struct git_hash_ctx *ctx) 117 117 { 118 118 git_SHA1_Init_unsafe(&ctx->state.sha1_unsafe); 119 119 } 120 120 121 - static void git_hash_sha1_clone_unsafe(git_hash_ctx *dst, const git_hash_ctx *src) 121 + static void git_hash_sha1_clone_unsafe(struct git_hash_ctx *dst, const struct git_hash_ctx *src) 122 122 { 123 123 git_SHA1_Clone_unsafe(&dst->state.sha1_unsafe, &src->state.sha1_unsafe); 124 124 } 125 125 126 - static void git_hash_sha1_update_unsafe(git_hash_ctx *ctx, const void *data, 126 + static void git_hash_sha1_update_unsafe(struct git_hash_ctx *ctx, const void *data, 127 127 size_t len) 128 128 { 129 129 git_SHA1_Update_unsafe(&ctx->state.sha1_unsafe, data, len); 130 130 } 131 131 132 - static void git_hash_sha1_final_unsafe(unsigned char *hash, git_hash_ctx *ctx) 132 + static void git_hash_sha1_final_unsafe(unsigned char *hash, struct git_hash_ctx *ctx) 133 133 { 134 134 git_SHA1_Final_unsafe(hash, &ctx->state.sha1_unsafe); 135 135 } 136 136 137 - static void git_hash_sha1_final_oid_unsafe(struct object_id *oid, git_hash_ctx *ctx) 137 + static void git_hash_sha1_final_oid_unsafe(struct object_id *oid, struct git_hash_ctx *ctx) 138 138 { 139 139 git_SHA1_Final_unsafe(oid->hash, &ctx->state.sha1_unsafe); 140 140 memset(oid->hash + GIT_SHA1_RAWSZ, 0, GIT_MAX_RAWSZ - GIT_SHA1_RAWSZ); 141 141 oid->algo = GIT_HASH_SHA1; 142 142 } 143 143 144 - static void git_hash_sha256_init(git_hash_ctx *ctx) 144 + static void git_hash_sha256_init(struct git_hash_ctx *ctx) 145 145 { 146 146 git_SHA256_Init(&ctx->state.sha256); 147 147 } 148 148 149 - static void git_hash_sha256_clone(git_hash_ctx *dst, const git_hash_ctx *src) 149 + static void git_hash_sha256_clone(struct git_hash_ctx *dst, const struct git_hash_ctx *src) 150 150 { 151 151 git_SHA256_Clone(&dst->state.sha256, &src->state.sha256); 152 152 } 153 153 154 - static void git_hash_sha256_update(git_hash_ctx *ctx, const void *data, size_t len) 154 + static void git_hash_sha256_update(struct git_hash_ctx *ctx, const void *data, size_t len) 155 155 { 156 156 git_SHA256_Update(&ctx->state.sha256, data, len); 157 157 } 158 158 159 - static void git_hash_sha256_final(unsigned char *hash, git_hash_ctx *ctx) 159 + static void git_hash_sha256_final(unsigned char *hash, struct git_hash_ctx *ctx) 160 160 { 161 161 git_SHA256_Final(hash, &ctx->state.sha256); 162 162 } 163 163 164 - static void git_hash_sha256_final_oid(struct object_id *oid, git_hash_ctx *ctx) 164 + static void git_hash_sha256_final_oid(struct object_id *oid, struct git_hash_ctx *ctx) 165 165 { 166 166 git_SHA256_Final(oid->hash, &ctx->state.sha256); 167 167 /* ··· 172 172 oid->algo = GIT_HASH_SHA256; 173 173 } 174 174 175 - static void git_hash_unknown_init(git_hash_ctx *ctx UNUSED) 175 + static void git_hash_unknown_init(struct git_hash_ctx *ctx UNUSED) 176 176 { 177 177 BUG("trying to init unknown hash"); 178 178 } 179 179 180 - static void git_hash_unknown_clone(git_hash_ctx *dst UNUSED, 181 - const git_hash_ctx *src UNUSED) 180 + static void git_hash_unknown_clone(struct git_hash_ctx *dst UNUSED, 181 + const struct git_hash_ctx *src UNUSED) 182 182 { 183 183 BUG("trying to clone unknown hash"); 184 184 } 185 185 186 - static void git_hash_unknown_update(git_hash_ctx *ctx UNUSED, 186 + static void git_hash_unknown_update(struct git_hash_ctx *ctx UNUSED, 187 187 const void *data UNUSED, 188 188 size_t len UNUSED) 189 189 { ··· 191 191 } 192 192 193 193 static void git_hash_unknown_final(unsigned char *hash UNUSED, 194 - git_hash_ctx *ctx UNUSED) 194 + struct git_hash_ctx *ctx UNUSED) 195 195 { 196 196 BUG("trying to finalize unknown hash"); 197 197 } 198 198 199 199 static void git_hash_unknown_final_oid(struct object_id *oid UNUSED, 200 - git_hash_ctx *ctx UNUSED) 200 + struct git_hash_ctx *ctx UNUSED) 201 201 { 202 202 BUG("trying to finalize unknown hash"); 203 203 } ··· 1180 1180 unsigned long size; 1181 1181 enum object_type obj_type; 1182 1182 struct git_istream *st; 1183 - git_hash_ctx c; 1183 + struct git_hash_ctx c; 1184 1184 char hdr[MAX_HEADER_LEN]; 1185 1185 int hdrlen; 1186 1186 ··· 1945 1945 } 1946 1946 } 1947 1947 1948 - static void hash_object_body(const struct git_hash_algo *algo, git_hash_ctx *c, 1948 + static void hash_object_body(const struct git_hash_algo *algo, struct git_hash_ctx *c, 1949 1949 const void *buf, unsigned long len, 1950 1950 struct object_id *oid, 1951 1951 char *hdr, int *hdrlen) ··· 1961 1961 enum object_type type, struct object_id *oid, 1962 1962 char *hdr, int *hdrlen) 1963 1963 { 1964 - git_hash_ctx c; 1964 + struct git_hash_ctx c; 1965 1965 1966 1966 /* Generate the header */ 1967 1967 *hdrlen = format_object_header(hdr, *hdrlen, type, len); ··· 1975 1975 const char *type, struct object_id *oid, 1976 1976 char *hdr, int *hdrlen) 1977 1977 { 1978 - git_hash_ctx c; 1978 + struct git_hash_ctx c; 1979 1979 1980 1980 *hdrlen = format_object_header_literally(hdr, *hdrlen, type, len); 1981 1981 hash_object_body(algo, &c, buf, len, oid, hdr, hdrlen); ··· 2206 2206 const char *filename, unsigned flags, 2207 2207 git_zstream *stream, 2208 2208 unsigned char *buf, size_t buflen, 2209 - git_hash_ctx *c, git_hash_ctx *compat_c, 2209 + struct git_hash_ctx *c, struct git_hash_ctx *compat_c, 2210 2210 char *hdr, int hdrlen) 2211 2211 { 2212 2212 struct repository *repo = the_repository; ··· 2251 2251 * Common steps for the inner git_deflate() loop for writing loose 2252 2252 * objects. Returns what git_deflate() returns. 2253 2253 */ 2254 - static int write_loose_object_common(git_hash_ctx *c, git_hash_ctx *compat_c, 2254 + static int write_loose_object_common(struct git_hash_ctx *c, struct git_hash_ctx *compat_c, 2255 2255 git_zstream *stream, const int flush, 2256 2256 unsigned char *in0, const int fd, 2257 2257 unsigned char *compressed, ··· 2280 2280 * - End the compression of zlib stream. 2281 2281 * - Get the calculated oid to "oid". 2282 2282 */ 2283 - static int end_loose_object_common(git_hash_ctx *c, git_hash_ctx *compat_c, 2283 + static int end_loose_object_common(struct git_hash_ctx *c, struct git_hash_ctx *compat_c, 2284 2284 git_zstream *stream, struct object_id *oid, 2285 2285 struct object_id *compat_oid) 2286 2286 { ··· 2306 2306 int fd, ret; 2307 2307 unsigned char compressed[4096]; 2308 2308 git_zstream stream; 2309 - git_hash_ctx c; 2309 + struct git_hash_ctx c; 2310 2310 struct object_id parano_oid; 2311 2311 static struct strbuf tmp_file = STRBUF_INIT; 2312 2312 static struct strbuf filename = STRBUF_INIT; ··· 2386 2386 int fd, ret, err = 0, flush = 0; 2387 2387 unsigned char compressed[4096]; 2388 2388 git_zstream stream; 2389 - git_hash_ctx c, compat_c; 2389 + struct git_hash_ctx c, compat_c; 2390 2390 struct strbuf tmp_file = STRBUF_INIT; 2391 2391 struct strbuf filename = STRBUF_INIT; 2392 2392 int dirlen; ··· 3046 3046 const char *path, 3047 3047 const struct object_id *expected_oid) 3048 3048 { 3049 - git_hash_ctx c; 3049 + struct git_hash_ctx c; 3050 3050 struct object_id real_oid; 3051 3051 unsigned char buf[4096]; 3052 3052 unsigned long total_read;
+1 -1
pack-check.c
··· 58 58 { 59 59 off_t index_size = p->index_size; 60 60 const unsigned char *index_base = p->index_data; 61 - git_hash_ctx ctx; 61 + struct git_hash_ctx ctx; 62 62 unsigned char hash[GIT_MAX_RAWSZ], *pack_sig; 63 63 off_t offset = 0, pack_sig_ofs = 0; 64 64 uint32_t nr_objects, i;
+1 -1
pack-write.c
··· 388 388 off_t partial_pack_offset) 389 389 { 390 390 int aligned_sz, buf_sz = 8 * 1024; 391 - git_hash_ctx old_hash_ctx, new_hash_ctx; 391 + struct git_hash_ctx old_hash_ctx, new_hash_ctx; 392 392 struct pack_header hdr; 393 393 char *buf; 394 394 ssize_t read_result;
+6 -6
read-cache.c
··· 1717 1717 1718 1718 static int verify_hdr(const struct cache_header *hdr, unsigned long size) 1719 1719 { 1720 - git_hash_ctx c; 1720 + struct git_hash_ctx c; 1721 1721 unsigned char hash[GIT_MAX_RAWSZ]; 1722 1722 int hdr_version; 1723 1723 unsigned char *start, *end; ··· 2002 2002 static void write_ieot_extension(struct strbuf *sb, struct index_entry_offset_table *ieot); 2003 2003 2004 2004 static size_t read_eoie_extension(const char *mmap, size_t mmap_size); 2005 - static void write_eoie_extension(struct strbuf *sb, git_hash_ctx *eoie_context, size_t offset); 2005 + static void write_eoie_extension(struct strbuf *sb, struct git_hash_ctx *eoie_context, size_t offset); 2006 2006 2007 2007 struct load_index_extensions 2008 2008 { ··· 2566 2566 } 2567 2567 2568 2568 static int write_index_ext_header(struct hashfile *f, 2569 - git_hash_ctx *eoie_f, 2569 + struct git_hash_ctx *eoie_f, 2570 2570 unsigned int ext, 2571 2571 unsigned int sz) 2572 2572 { ··· 2831 2831 { 2832 2832 uint64_t start = getnanotime(); 2833 2833 struct hashfile *f; 2834 - git_hash_ctx *eoie_c = NULL; 2834 + struct git_hash_ctx *eoie_c = NULL; 2835 2835 struct cache_header hdr; 2836 2836 int i, err = 0, removed, extended, hdr_version; 2837 2837 struct cache_entry **cache = istate->cache; ··· 3579 3579 uint32_t extsize; 3580 3580 size_t offset, src_offset; 3581 3581 unsigned char hash[GIT_MAX_RAWSZ]; 3582 - git_hash_ctx c; 3582 + struct git_hash_ctx c; 3583 3583 3584 3584 /* ensure we have an index big enough to contain an EOIE extension */ 3585 3585 if (mmap_size < sizeof(struct cache_header) + EOIE_SIZE_WITH_HEADER + the_hash_algo->rawsz) ··· 3650 3650 return offset; 3651 3651 } 3652 3652 3653 - static void write_eoie_extension(struct strbuf *sb, git_hash_ctx *eoie_context, size_t offset) 3653 + static void write_eoie_extension(struct strbuf *sb, struct git_hash_ctx *eoie_context, size_t offset) 3654 3654 { 3655 3655 uint32_t buffer; 3656 3656 unsigned char hash[GIT_MAX_RAWSZ];
+2 -2
rerere.c
··· 358 358 } 359 359 360 360 static int handle_conflict(struct strbuf *out, struct rerere_io *io, 361 - int marker_size, git_hash_ctx *ctx) 361 + int marker_size, struct git_hash_ctx *ctx) 362 362 { 363 363 enum { 364 364 RR_SIDE_1 = 0, RR_SIDE_2, RR_ORIGINAL ··· 432 432 */ 433 433 static int handle_path(unsigned char *hash, struct rerere_io *io, int marker_size) 434 434 { 435 - git_hash_ctx ctx; 435 + struct git_hash_ctx ctx; 436 436 struct strbuf buf = STRBUF_INIT, out = STRBUF_INIT; 437 437 int has_conflicts = 0; 438 438 if (hash)
+2 -2
t/helper/test-hash-speed.c
··· 3 3 4 4 #define NUM_SECONDS 3 5 5 6 - static inline void compute_hash(const struct git_hash_algo *algo, git_hash_ctx *ctx, uint8_t *final, const void *p, size_t len) 6 + static inline void compute_hash(const struct git_hash_algo *algo, struct git_hash_ctx *ctx, uint8_t *final, const void *p, size_t len) 7 7 { 8 8 algo->init_fn(ctx); 9 9 algo->update_fn(ctx, p, len); ··· 12 12 13 13 int cmd__hash_speed(int ac, const char **av) 14 14 { 15 - git_hash_ctx ctx; 15 + struct git_hash_ctx ctx; 16 16 unsigned char hash[GIT_MAX_RAWSZ]; 17 17 clock_t initial, start, end; 18 18 unsigned bufsizes[] = { 64, 256, 1024, 8192, 16384 };
+1 -1
t/helper/test-hash.c
··· 3 3 4 4 int cmd_hash_impl(int ac, const char **av, int algo, int unsafe) 5 5 { 6 - git_hash_ctx ctx; 6 + struct git_hash_ctx ctx; 7 7 unsigned char hash[GIT_MAX_HEXSZ]; 8 8 unsigned bufsz = 8192; 9 9 int binary = 0;
+1 -1
t/unit-tests/u-hash.c
··· 8 8 cl_assert(data != NULL); 9 9 10 10 for (size_t i = 1; i < ARRAY_SIZE(hash_algos); i++) { 11 - git_hash_ctx ctx; 11 + struct git_hash_ctx ctx; 12 12 unsigned char hash[GIT_MAX_HEXSZ]; 13 13 const struct git_hash_algo *algop = &hash_algos[i]; 14 14
+1 -1
trace2/tr2_sid.c
··· 32 32 { 33 33 const struct git_hash_algo *algo = &hash_algos[GIT_HASH_SHA1]; 34 34 struct tr2_tbuf tb_now; 35 - git_hash_ctx ctx; 35 + struct git_hash_ctx ctx; 36 36 pid_t pid = getpid(); 37 37 unsigned char hash[GIT_MAX_RAWSZ + 1]; 38 38 char hex[GIT_MAX_HEXSZ + 1];