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>

Patrick Steinhardt committed Jan 31, 2025 at 13:55 UTC 7346e340f147131ca32089f61f7d0f502f80d19d
22 files changed +73 -74
builtin/fast-import.c
+2 -2
@@ -953,7 +953,7 @@ static int store_object(
953 unsigned char hdr[96];
954 struct object_id oid;
955 unsigned long hdrlen, deltalen;
956 - git_hash_ctx c;
956 + struct git_hash_ctx c;
957 git_zstream s;
958
959 hdrlen = format_object_header((char *)hdr, sizeof(hdr), type,
@@ -1095,7 +1095,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark)
1095 struct object_id oid;
1096 unsigned long hdrlen;
1097 off_t offset;
1098 - git_hash_ctx c;
1098 + struct git_hash_ctx c;
1099 git_zstream s;
1100 struct hashfile_checkpoint checkpoint;
1101 int status = Z_OK;
builtin/index-pack.c
+3 -3
@@ -151,7 +151,7 @@ static unsigned int input_offset, input_len;
151 static off_t consumed_bytes;
152 static off_t max_input_size;
153 static unsigned deepest_delta;
154 -static git_hash_ctx input_ctx;
154 +static struct git_hash_ctx input_ctx;
155 static uint32_t input_crc32;
156 static int input_fd, output_fd;
157 static const char *curr_pack;
@@ -475,7 +475,7 @@ static void *unpack_entry_data(off_t offset, unsigned long size,
475 int status;
476 git_zstream stream;
477 void *buf;
478 - git_hash_ctx c;
478 + struct git_hash_ctx c;
479 char hdr[32];
480 int hdrlen;
481
@@ -1248,7 +1248,7 @@ static void parse_pack_objects(unsigned char *hash)
1248 struct ofs_delta_entry *ofs_delta = ofs_deltas;
1249 struct object_id ref_delta_oid;
1250 struct stat st;
1251 - git_hash_ctx tmp_ctx;
1251 + struct git_hash_ctx tmp_ctx;
1252
1253 if (verbose)
1254 progress = start_progress(
builtin/patch-id.c
+1 -1
@@ -70,7 +70,7 @@ static size_t get_one_patchid(struct object_id *next_oid, struct object_id *resu
70 int before = -1, after = -1;
71 int diff_is_binary = 0;
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
75 the_hash_algo->init_fn(&ctx);
76 oidclr(result, the_repository->hash_algo);
builtin/receive-pack.c
+1 -1
@@ -566,7 +566,7 @@ static void hmac_hash(unsigned char *out,
566 unsigned char k_ipad[GIT_MAX_BLKSZ];
567 unsigned char k_opad[GIT_MAX_BLKSZ];
568 int i;
569 - git_hash_ctx ctx;
569 + struct git_hash_ctx ctx;
570
571 /* RFC 2104 2. (1) */
572 memset(key, '\0', GIT_MAX_BLKSZ);
builtin/unpack-objects.c
+2 -2
@@ -28,7 +28,7 @@ static unsigned char buffer[4096];
28 static unsigned int offset, len;
29 static off_t consumed_bytes;
30 static off_t max_input_size;
31 -static git_hash_ctx ctx;
31 +static struct git_hash_ctx ctx;
32 static struct fsck_options fsck_options = FSCK_OPTIONS_STRICT;
33 static struct progress *progress;
34
@@ -614,7 +614,7 @@ int cmd_unpack_objects(int argc,
614 {
615 int i;
616 struct object_id oid;
617 - git_hash_ctx tmp_ctx;
617 + struct git_hash_ctx tmp_ctx;
618
619 disable_replace_refs();
620
bulk-checkin.c
+2 -2
@@ -161,7 +161,7 @@ static int already_written(struct bulk_checkin_packfile *state, struct object_id
161 * with a new pack.
162 */
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 int fd, size_t size, const char *path,
166 unsigned flags)
167 {
@@ -258,7 +258,7 @@ static int deflate_blob_to_pack(struct bulk_checkin_packfile *state,
258 const char *path, unsigned flags)
259 {
260 off_t seekback, already_hashed_to;
261 - git_hash_ctx ctx;
261 + struct git_hash_ctx ctx;
262 unsigned char obuf[16384];
263 unsigned header_len;
264 struct hashfile_checkpoint checkpoint;
csum-file.c
+1 -1
@@ -248,7 +248,7 @@ uint32_t crc32_end(struct hashfile *f)
248 int hashfile_checksum_valid(const unsigned char *data, size_t total_len)
249 {
250 unsigned char got[GIT_MAX_RAWSZ];
251 - git_hash_ctx ctx;
251 + struct git_hash_ctx ctx;
252 const struct git_hash_algo *algop = unsafe_hash_algo(the_hash_algo);
253 size_t data_len = total_len - algop->rawsz;
254
csum-file.h
+2 -2
@@ -11,7 +11,7 @@ struct hashfile {
11 int fd;
12 int check_fd;
13 unsigned int offset;
14 - git_hash_ctx ctx;
14 + struct git_hash_ctx ctx;
15 off_t total;
16 struct progress *tp;
17 const char *name;
@@ -33,7 +33,7 @@ struct hashfile {
33 /* Checkpoint */
34 struct hashfile_checkpoint {
35 off_t offset;
36 - git_hash_ctx ctx;
36 + struct git_hash_ctx ctx;
37 };
38
39 void hashfile_checkpoint_init(struct hashfile *, struct hashfile_checkpoint *);
diff.c
+5 -5
@@ -6392,7 +6392,7 @@ static void diff_summary(struct diff_options *opt, struct diff_filepair *p)
6392 }
6393
6394 struct patch_id_t {
6395 - git_hash_ctx *ctx;
6395 + struct git_hash_ctx *ctx;
6396 int patchlen;
6397 };
6398
@@ -6409,7 +6409,7 @@ static int remove_space(char *line, int len)
6409 return dst - line;
6410 }
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 {
6414 unsigned char hash[GIT_MAX_RAWSZ];
6415 unsigned short carry = 0;
@@ -6439,12 +6439,12 @@ static int patch_id_consume(void *priv, char *line, unsigned long len)
6439 return 0;
6440 }
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 {
6444 the_hash_algo->update_fn(ctx, str, strlen(str));
6445 }
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 {
6449 /* large enough for 2^32 in octal */
6450 char buf[12];
@@ -6457,7 +6457,7 @@ static int diff_get_patch_id(struct diff_options *options, struct object_id *oid
6457 {
6458 struct diff_queue_struct *q = &diff_queued_diff;
6459 int i;
6460 - git_hash_ctx ctx;
6460 + struct git_hash_ctx ctx;
6461 struct patch_id_t data;
6462
6463 the_hash_algo->init_fn(&ctx);
diff.h
+1 -1
@@ -644,7 +644,7 @@ void run_diff_index(struct rev_info *revs, unsigned int option);
644
645 int do_diff_cache(const struct object_id *, struct diff_options *);
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
649 int diff_result_code(struct rev_info *);
650
hash.h
+5 -6
@@ -241,13 +241,12 @@ struct git_hash_ctx {
241 git_SHA256_CTX sha256;
242 } state;
243 };
244 -typedef struct git_hash_ctx git_hash_ctx;
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);
250
251 struct git_hash_algo {
252 /*
http-push.c
+1 -1
@@ -760,7 +760,7 @@ static void handle_lockprop_ctx(struct xml_ctx *ctx, int tag_closed)
760 static void handle_new_lock_ctx(struct xml_ctx *ctx, int tag_closed)
761 {
762 struct remote_lock *lock = (struct remote_lock *)ctx->userData;
763 - git_hash_ctx hash_ctx;
763 + struct git_hash_ctx hash_ctx;
764 unsigned char lock_token_hash[GIT_MAX_RAWSZ];
765
766 if (tag_closed && ctx->cdata) {
http.h
+1 -1
@@ -228,7 +228,7 @@ struct http_object_request {
228 long http_code;
229 struct object_id oid;
230 struct object_id real_oid;
231 - git_hash_ctx c;
231 + struct git_hash_ctx c;
232 git_zstream stream;
233 int zret;
234 int rename;
object-file.c
+31 -31
@@ -86,82 +86,82 @@ static const struct object_id null_oid_sha256 = {
86 .algo = GIT_HASH_SHA256,
87 };
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 {
91 git_SHA1_Init(&ctx->state.sha1);
92 }
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 {
96 git_SHA1_Clone(&dst->state.sha1, &src->state.sha1);
97 }
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 {
101 git_SHA1_Update(&ctx->state.sha1, data, len);
102 }
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 {
106 git_SHA1_Final(hash, &ctx->state.sha1);
107 }
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 {
111 git_SHA1_Final(oid->hash, &ctx->state.sha1);
112 memset(oid->hash + GIT_SHA1_RAWSZ, 0, GIT_MAX_RAWSZ - GIT_SHA1_RAWSZ);
113 oid->algo = GIT_HASH_SHA1;
114 }
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 {
118 git_SHA1_Init_unsafe(&ctx->state.sha1_unsafe);
119 }
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 {
123 git_SHA1_Clone_unsafe(&dst->state.sha1_unsafe, &src->state.sha1_unsafe);
124 }
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 size_t len)
128 {
129 git_SHA1_Update_unsafe(&ctx->state.sha1_unsafe, data, len);
130 }
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 {
134 git_SHA1_Final_unsafe(hash, &ctx->state.sha1_unsafe);
135 }
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 {
139 git_SHA1_Final_unsafe(oid->hash, &ctx->state.sha1_unsafe);
140 memset(oid->hash + GIT_SHA1_RAWSZ, 0, GIT_MAX_RAWSZ - GIT_SHA1_RAWSZ);
141 oid->algo = GIT_HASH_SHA1;
142 }
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 {
146 git_SHA256_Init(&ctx->state.sha256);
147 }
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 {
151 git_SHA256_Clone(&dst->state.sha256, &src->state.sha256);
152 }
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 {
156 git_SHA256_Update(&ctx->state.sha256, data, len);
157 }
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 {
161 git_SHA256_Final(hash, &ctx->state.sha256);
162 }
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 {
166 git_SHA256_Final(oid->hash, &ctx->state.sha256);
167 /*
@@ -172,18 +172,18 @@ static void git_hash_sha256_final_oid(struct object_id *oid, git_hash_ctx *ctx)
172 oid->algo = GIT_HASH_SHA256;
173 }
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 {
177 BUG("trying to init unknown hash");
178 }
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 {
183 BUG("trying to clone unknown hash");
184 }
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 const void *data UNUSED,
188 size_t len UNUSED)
189 {
@@ -191,13 +191,13 @@ static void git_hash_unknown_update(git_hash_ctx *ctx UNUSED,
191 }
192
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 {
196 BUG("trying to finalize unknown hash");
197 }
198
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 {
202 BUG("trying to finalize unknown hash");
203 }
@@ -1180,7 +1180,7 @@ int stream_object_signature(struct repository *r, const struct object_id *oid)
1180 unsigned long size;
1181 enum object_type obj_type;
1182 struct git_istream *st;
1183 - git_hash_ctx c;
1183 + struct git_hash_ctx c;
1184 char hdr[MAX_HEADER_LEN];
1185 int hdrlen;
1186
@@ -1945,7 +1945,7 @@ void *read_object_with_reference(struct repository *r,
1945 }
1946 }
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 const void *buf, unsigned long len,
1950 struct object_id *oid,
1951 char *hdr, int *hdrlen)
@@ -1961,7 +1961,7 @@ static void write_object_file_prepare(const struct git_hash_algo *algo,
1961 enum object_type type, struct object_id *oid,
1962 char *hdr, int *hdrlen)
1963 {
1964 - git_hash_ctx c;
1964 + struct git_hash_ctx c;
1965
1966 /* Generate the header */
1967 *hdrlen = format_object_header(hdr, *hdrlen, type, len);
@@ -1975,7 +1975,7 @@ static void write_object_file_prepare_literally(const struct git_hash_algo *algo
1975 const char *type, struct object_id *oid,
1976 char *hdr, int *hdrlen)
1977 {
1978 - git_hash_ctx c;
1978 + struct git_hash_ctx c;
1979
1980 *hdrlen = format_object_header_literally(hdr, *hdrlen, type, len);
1981 hash_object_body(algo, &c, buf, len, oid, hdr, hdrlen);
@@ -2206,7 +2206,7 @@ static int start_loose_object_common(struct strbuf *tmp_file,
2206 const char *filename, unsigned flags,
2207 git_zstream *stream,
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 char *hdr, int hdrlen)
2211 {
2212 struct repository *repo = the_repository;
@@ -2251,7 +2251,7 @@ static int start_loose_object_common(struct strbuf *tmp_file,
2251 * Common steps for the inner git_deflate() loop for writing loose
2252 * objects. Returns what git_deflate() returns.
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 git_zstream *stream, const int flush,
2256 unsigned char *in0, const int fd,
2257 unsigned char *compressed,
@@ -2280,7 +2280,7 @@ static int write_loose_object_common(git_hash_ctx *c, git_hash_ctx *compat_c,
2280 * - End the compression of zlib stream.
2281 * - Get the calculated oid to "oid".
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 git_zstream *stream, struct object_id *oid,
2285 struct object_id *compat_oid)
2286 {
@@ -2306,7 +2306,7 @@ static int write_loose_object(const struct object_id *oid, char *hdr,
2306 int fd, ret;
2307 unsigned char compressed[4096];
2308 git_zstream stream;
2309 - git_hash_ctx c;
2309 + struct git_hash_ctx c;
2310 struct object_id parano_oid;
2311 static struct strbuf tmp_file = STRBUF_INIT;
2312 static struct strbuf filename = STRBUF_INIT;
@@ -2386,7 +2386,7 @@ int stream_loose_object(struct input_stream *in_stream, size_t len,
2386 int fd, ret, err = 0, flush = 0;
2387 unsigned char compressed[4096];
2388 git_zstream stream;
2389 - git_hash_ctx c, compat_c;
2389 + struct git_hash_ctx c, compat_c;
2390 struct strbuf tmp_file = STRBUF_INIT;
2391 struct strbuf filename = STRBUF_INIT;
2392 int dirlen;
@@ -3046,7 +3046,7 @@ static int check_stream_oid(git_zstream *stream,
3046 const char *path,
3047 const struct object_id *expected_oid)
3048 {
3049 - git_hash_ctx c;
3049 + struct git_hash_ctx c;
3050 struct object_id real_oid;
3051 unsigned char buf[4096];
3052 unsigned long total_read;
pack-check.c
+1 -1
@@ -58,7 +58,7 @@ static int verify_packfile(struct repository *r,
58 {
59 off_t index_size = p->index_size;
60 const unsigned char *index_base = p->index_data;
61 - git_hash_ctx ctx;
61 + struct git_hash_ctx ctx;
62 unsigned char hash[GIT_MAX_RAWSZ], *pack_sig;
63 off_t offset = 0, pack_sig_ofs = 0;
64 uint32_t nr_objects, i;
pack-write.c
+1 -1
@@ -388,7 +388,7 @@ void fixup_pack_header_footer(int pack_fd,
388 off_t partial_pack_offset)
389 {
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 struct pack_header hdr;
393 char *buf;
394 ssize_t read_result;
read-cache.c
+6 -6
@@ -1717,7 +1717,7 @@ int verify_ce_order;
1717
1718 static int verify_hdr(const struct cache_header *hdr, unsigned long size)
1719 {
1720 - git_hash_ctx c;
1720 + struct git_hash_ctx c;
1721 unsigned char hash[GIT_MAX_RAWSZ];
1722 int hdr_version;
1723 unsigned char *start, *end;
@@ -2002,7 +2002,7 @@ static struct index_entry_offset_table *read_ieot_extension(const char *mmap, si
2002 static void write_ieot_extension(struct strbuf *sb, struct index_entry_offset_table *ieot);
2003
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
2007 struct load_index_extensions
2008 {
@@ -2566,7 +2566,7 @@ int repo_index_has_changes(struct repository *repo,
2566 }
2567
2568 static int write_index_ext_header(struct hashfile *f,
2569 - git_hash_ctx *eoie_f,
2569 + struct git_hash_ctx *eoie_f,
2570 unsigned int ext,
2571 unsigned int sz)
2572 {
@@ -2831,7 +2831,7 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
2831 {
2832 uint64_t start = getnanotime();
2833 struct hashfile *f;
2834 - git_hash_ctx *eoie_c = NULL;
2834 + struct git_hash_ctx *eoie_c = NULL;
2835 struct cache_header hdr;
2836 int i, err = 0, removed, extended, hdr_version;
2837 struct cache_entry **cache = istate->cache;
@@ -3579,7 +3579,7 @@ static size_t read_eoie_extension(const char *mmap, size_t mmap_size)
3579 uint32_t extsize;
3580 size_t offset, src_offset;
3581 unsigned char hash[GIT_MAX_RAWSZ];
3582 - git_hash_ctx c;
3582 + struct git_hash_ctx c;
3583
3584 /* ensure we have an index big enough to contain an EOIE extension */
3585 if (mmap_size < sizeof(struct cache_header) + EOIE_SIZE_WITH_HEADER + the_hash_algo->rawsz)
@@ -3650,7 +3650,7 @@ static size_t read_eoie_extension(const char *mmap, size_t mmap_size)
3650 return offset;
3651 }
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 {
3655 uint32_t buffer;
3656 unsigned char hash[GIT_MAX_RAWSZ];
rerere.c
+2 -2
@@ -358,7 +358,7 @@ static void rerere_strbuf_putconflict(struct strbuf *buf, int ch, size_t size)
358 }
359
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 {
363 enum {
364 RR_SIDE_1 = 0, RR_SIDE_2, RR_ORIGINAL
@@ -432,7 +432,7 @@ static int handle_conflict(struct strbuf *out, struct rerere_io *io,
432 */
433 static int handle_path(unsigned char *hash, struct rerere_io *io, int marker_size)
434 {
435 - git_hash_ctx ctx;
435 + struct git_hash_ctx ctx;
436 struct strbuf buf = STRBUF_INIT, out = STRBUF_INIT;
437 int has_conflicts = 0;
438 if (hash)
t/helper/test-hash-speed.c
+2 -2
@@ -3,7 +3,7 @@
3
4 #define NUM_SECONDS 3
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 {
8 algo->init_fn(ctx);
9 algo->update_fn(ctx, p, len);
@@ -12,7 +12,7 @@ static inline void compute_hash(const struct git_hash_algo *algo, git_hash_ctx *
12
13 int cmd__hash_speed(int ac, const char **av)
14 {
15 - git_hash_ctx ctx;
15 + struct git_hash_ctx ctx;
16 unsigned char hash[GIT_MAX_RAWSZ];
17 clock_t initial, start, end;
18 unsigned bufsizes[] = { 64, 256, 1024, 8192, 16384 };
t/helper/test-hash.c
+1 -1
@@ -3,7 +3,7 @@
3
4 int cmd_hash_impl(int ac, const char **av, int algo, int unsafe)
5 {
6 - git_hash_ctx ctx;
6 + struct git_hash_ctx ctx;
7 unsigned char hash[GIT_MAX_HEXSZ];
8 unsigned bufsz = 8192;
9 int binary = 0;
t/unit-tests/u-hash.c
+1 -1
@@ -8,7 +8,7 @@ static void check_hash_data(const void *data, size_t data_length,
8 cl_assert(data != NULL);
9
10 for (size_t i = 1; i < ARRAY_SIZE(hash_algos); i++) {
11 - git_hash_ctx ctx;
11 + struct git_hash_ctx ctx;
12 unsigned char hash[GIT_MAX_HEXSZ];
13 const struct git_hash_algo *algop = &hash_algos[i];
14
trace2/tr2_sid.c
+1 -1
@@ -32,7 +32,7 @@ static void tr2_sid_append_my_sid_component(void)
32 {
33 const struct git_hash_algo *algo = &hash_algos[GIT_HASH_SHA1];
34 struct tr2_tbuf tb_now;
35 - git_hash_ctx ctx;
35 + struct git_hash_ctx ctx;
36 pid_t pid = getpid();
37 unsigned char hash[GIT_MAX_RAWSZ + 1];
38 char hex[GIT_MAX_HEXSZ + 1];