summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-01-10 10:33:09 -0800
committerJunio C Hamano <gitster@pobox.com>2014-01-10 10:33:09 -0800
commitf06a5e607dde266884db4a99b70fbee09d5c5efc (patch)
tree76f4f796e45646182ffce1146b6a1017fcfd7320
parent4ba46c28471b94de561d00f8b01da79b59527c62 (diff)
parent9af270e8c2a02afd9a3262a2c9312ee7fefbb7a3 (diff)
downloadgit-f06a5e607dde266884db4a99b70fbee09d5c5efc.tar.gz
Merge branch 'jk/sha1write-void'
Code clean-up. * jk/sha1write-void: do not pretend sha1write returns errors
-rw-r--r--builtin/pack-objects.c2
-rw-r--r--csum-file.c3
-rw-r--r--csum-file.h2
-rw-r--r--pack-write.c3
4 files changed, 3 insertions, 7 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index dfb4d84caa..541667f102 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -737,8 +737,6 @@ static void write_pack_file(void)
f = create_tmp_packfile(&pack_tmp_name);
offset = write_pack_header(f, nr_remaining);
- if (!offset)
- die_errno("unable to write pack header");
nr_written = 0;
for (; i < nr_objects; i++) {
struct object_entry *e = write_order[i];
diff --git a/csum-file.c b/csum-file.c
index 465971c7f3..b00b215031 100644
--- a/csum-file.c
+++ b/csum-file.c
@@ -86,7 +86,7 @@ int sha1close(struct sha1file *f, unsigned char *result, unsigned int flags)
return fd;
}
-int sha1write(struct sha1file *f, const void *buf, unsigned int count)
+void sha1write(struct sha1file *f, const void *buf, unsigned int count)
{
while (count) {
unsigned offset = f->offset;
@@ -116,7 +116,6 @@ int sha1write(struct sha1file *f, const void *buf, unsigned int count)
}
f->offset = offset;
}
- return 0;
}
struct sha1file *sha1fd(int fd, const char *name)
diff --git a/csum-file.h b/csum-file.h
index 9dedb038ea..bb543d52f1 100644
--- a/csum-file.h
+++ b/csum-file.h
@@ -34,7 +34,7 @@ extern struct sha1file *sha1fd(int fd, const char *name);
extern struct sha1file *sha1fd_check(const char *name);
extern struct sha1file *sha1fd_throughput(int fd, const char *name, struct progress *tp);
extern int sha1close(struct sha1file *, unsigned char *, unsigned int);
-extern int sha1write(struct sha1file *, const void *, unsigned int);
+extern void sha1write(struct sha1file *, const void *, unsigned int);
extern void sha1flush(struct sha1file *f);
extern void crc32_begin(struct sha1file *);
extern uint32_t crc32_end(struct sha1file *);
diff --git a/pack-write.c b/pack-write.c
index ddc174e1ad..605d01b25c 100644
--- a/pack-write.c
+++ b/pack-write.c
@@ -183,8 +183,7 @@ off_t write_pack_header(struct sha1file *f, uint32_t nr_entries)
hdr.hdr_signature = htonl(PACK_SIGNATURE);
hdr.hdr_version = htonl(PACK_VERSION);
hdr.hdr_entries = htonl(nr_entries);
- if (sha1write(f, &hdr, sizeof(hdr)))
- return 0;
+ sha1write(f, &hdr, sizeof(hdr));
return sizeof(hdr);
}