csum-file: rename hashclose() to finalize_hashfile()
The hashclose() method behaves very differently depending on the flags parameter. In particular, the file descriptor is not always closed. Perform a simple rename of "hashclose()" to "finalize_hashfile()" in preparation for functional changes. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Derrick Stolee committed
Apr 2, 2018 at 16:34 UTC
f2af9f5e02380ba3868df7daa34368945d500206
8 files changed
+13
-13
builtin/index-pack.c
+1
-1
@@ -1269,7 +1269,7 @@ static void conclude_pack(int fix_thin_pack, const char *curr_pack, unsigned cha
1269
nr_objects - nr_objects_initial);
1270
stop_progress_msg(&progress, msg.buf);
1271
strbuf_release(&msg);
1272
- hashclose(f, tail_hash, 0);
1272
+ finalize_hashfile(f, tail_hash, 0);
1273
hashcpy(read_hash, pack_hash);
1274
fixup_pack_header_footer(output_fd, pack_hash,
1275
curr_pack, nr_objects,
builtin/pack-objects.c
+3
-3
@@ -837,11 +837,11 @@ static void write_pack_file(void)
837
* If so, rewrite it like in fast-import
838
*/
839
if (pack_to_stdout) {
840
- hashclose(f, oid.hash, CSUM_CLOSE);
840
+ finalize_hashfile(f, oid.hash, CSUM_CLOSE);
841
} else if (nr_written == nr_remaining) {
842
- hashclose(f, oid.hash, CSUM_FSYNC);
842
+ finalize_hashfile(f, oid.hash, CSUM_FSYNC);
843
} else {
844
- int fd = hashclose(f, oid.hash, 0);
844
+ int fd = finalize_hashfile(f, oid.hash, 0);
845
fixup_pack_header_footer(fd, oid.hash, pack_tmp_name,
846
nr_written, oid.hash, offset);
847
close(fd);
bulk-checkin.c
+2
-2
@@ -35,9 +35,9 @@ static void finish_bulk_checkin(struct bulk_checkin_state *state)
35
unlink(state->pack_tmp_name);
36
goto clear_exit;
37
} else if (state->nr_written == 1) {
38
- hashclose(state->f, oid.hash, CSUM_FSYNC);
38
+ finalize_hashfile(state->f, oid.hash, CSUM_FSYNC);
39
} else {
40
- int fd = hashclose(state->f, oid.hash, 0);
40
+ int fd = finalize_hashfile(state->f, oid.hash, 0);
41
fixup_pack_header_footer(fd, oid.hash, state->pack_tmp_name,
42
state->nr_written, oid.hash,
43
state->offset);
csum-file.c
+1
-1
@@ -53,7 +53,7 @@ void hashflush(struct hashfile *f)
53
}
54
}
55
56
-int hashclose(struct hashfile *f, unsigned char *result, unsigned int flags)
56
+int finalize_hashfile(struct hashfile *f, unsigned char *result, unsigned int flags)
57
{
58
int fd;
59
csum-file.h
+2
-2
@@ -26,14 +26,14 @@ struct hashfile_checkpoint {
26
extern void hashfile_checkpoint(struct hashfile *, struct hashfile_checkpoint *);
27
extern int hashfile_truncate(struct hashfile *, struct hashfile_checkpoint *);
28
29
-/* hashclose flags */
29
+/* finalize_hashfile flags */
30
#define CSUM_CLOSE 1
31
#define CSUM_FSYNC 2
32
33
extern struct hashfile *hashfd(int fd, const char *name);
34
extern struct hashfile *hashfd_check(const char *name);
35
extern struct hashfile *hashfd_throughput(int fd, const char *name, struct progress *tp);
36
-extern int hashclose(struct hashfile *, unsigned char *, unsigned int);
36
+extern int finalize_hashfile(struct hashfile *, unsigned char *, unsigned int);
37
extern void hashwrite(struct hashfile *, const void *, unsigned int);
38
extern void hashflush(struct hashfile *f);
39
extern void crc32_begin(struct hashfile *);
fast-import.c
+1
-1
@@ -1016,7 +1016,7 @@ static void end_packfile(void)
1016
struct tag *t;
1017
1018
close_pack_windows(pack_data);
1019
- hashclose(pack_file, cur_pack_oid.hash, 0);
1019
+ finalize_hashfile(pack_file, cur_pack_oid.hash, 0);
1020
fixup_pack_header_footer(pack_data->pack_fd, pack_data->sha1,
1021
pack_data->pack_name, object_count,
1022
cur_pack_oid.hash, pack_size);
pack-bitmap-write.c
+1
-1
@@ -535,7 +535,7 @@ void bitmap_writer_finish(struct pack_idx_entry **index,
535
if (options & BITMAP_OPT_HASH_CACHE)
536
write_hash_cache(f, index, index_nr);
537
538
- hashclose(f, NULL, CSUM_FSYNC);
538
+ finalize_hashfile(f, NULL, CSUM_FSYNC);
539
540
if (adjust_shared_perm(tmp_file.buf))
541
die_errno("unable to make temporary bitmap file readable");
pack-write.c
+2
-2
@@ -170,8 +170,8 @@ const char *write_idx_file(const char *index_name, struct pack_idx_entry **objec
170
}
171
172
hashwrite(f, sha1, the_hash_algo->rawsz);
173
- hashclose(f, NULL, ((opts->flags & WRITE_IDX_VERIFY)
174
- ? CSUM_CLOSE : CSUM_FSYNC));
173
+ finalize_hashfile(f, NULL, ((opts->flags & WRITE_IDX_VERIFY)
174
+ ? CSUM_CLOSE : CSUM_FSYNC));
175
return index_name;
176
}
177