Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit f06a5e6

Browse files
committed
Merge branch 'jk/sha1write-void'
Code clean-up. * jk/sha1write-void: do not pretend sha1write returns errors
2 parents 4ba46c2 + 9af270e commit f06a5e6

File tree

4 files changed

+3
-7
lines changed

4 files changed

+3
-7
lines changed

builtin/pack-objects.c

-2
Original file line numberDiff line numberDiff line change
@@ -737,8 +737,6 @@ static void write_pack_file(void)
737737
f = create_tmp_packfile(&pack_tmp_name);
738738

739739
offset = write_pack_header(f, nr_remaining);
740-
if (!offset)
741-
die_errno("unable to write pack header");
742740
nr_written = 0;
743741
for (; i < nr_objects; i++) {
744742
struct object_entry *e = write_order[i];

csum-file.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ int sha1close(struct sha1file *f, unsigned char *result, unsigned int flags)
8686
return fd;
8787
}
8888

89-
int sha1write(struct sha1file *f, const void *buf, unsigned int count)
89+
void sha1write(struct sha1file *f, const void *buf, unsigned int count)
9090
{
9191
while (count) {
9292
unsigned offset = f->offset;
@@ -116,7 +116,6 @@ int sha1write(struct sha1file *f, const void *buf, unsigned int count)
116116
}
117117
f->offset = offset;
118118
}
119-
return 0;
120119
}
121120

122121
struct sha1file *sha1fd(int fd, const char *name)

csum-file.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ extern struct sha1file *sha1fd(int fd, const char *name);
3434
extern struct sha1file *sha1fd_check(const char *name);
3535
extern struct sha1file *sha1fd_throughput(int fd, const char *name, struct progress *tp);
3636
extern int sha1close(struct sha1file *, unsigned char *, unsigned int);
37-
extern int sha1write(struct sha1file *, const void *, unsigned int);
37+
extern void sha1write(struct sha1file *, const void *, unsigned int);
3838
extern void sha1flush(struct sha1file *f);
3939
extern void crc32_begin(struct sha1file *);
4040
extern uint32_t crc32_end(struct sha1file *);

pack-write.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,7 @@ off_t write_pack_header(struct sha1file *f, uint32_t nr_entries)
183183
hdr.hdr_signature = htonl(PACK_SIGNATURE);
184184
hdr.hdr_version = htonl(PACK_VERSION);
185185
hdr.hdr_entries = htonl(nr_entries);
186-
if (sha1write(f, &hdr, sizeof(hdr)))
187-
return 0;
186+
sha1write(f, &hdr, sizeof(hdr));
188187
return sizeof(hdr);
189188
}
190189

0 commit comments

Comments
 (0)