summaryrefslogtreecommitdiff
path: root/strbuf.c
diff options
context:
space:
mode:
authorPierre Habouzit <madcoder@debian.org>2007-09-27 13:25:55 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-09-30 04:26:10 (GMT)
commit387e7e19d7eb5444be8da8e99ed7491989dc1cbb (patch)
treeb1fcd32479e6d22abc0e2060e70ea7846fa2b273 /strbuf.c
parentb315c5c08139c0d3c1e4867a305334e29da01d07 (diff)
downloadgit-387e7e19d7eb5444be8da8e99ed7491989dc1cbb.zip
git-387e7e19d7eb5444be8da8e99ed7491989dc1cbb.tar.gz
git-387e7e19d7eb5444be8da8e99ed7491989dc1cbb.tar.bz2
strbuf_read_file enhancement, and use it.
* make strbuf_read_file take a size hint (works like strbuf_read) * use it in a couple of places. Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'strbuf.c')
-rw-r--r--strbuf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/strbuf.c b/strbuf.c
index 0e431da..f4201e1 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -186,14 +186,14 @@ int strbuf_getline(struct strbuf *sb, FILE *fp, int term)
return 0;
}
-int strbuf_read_file(struct strbuf *sb, const char *path)
+int strbuf_read_file(struct strbuf *sb, const char *path, size_t hint)
{
int fd, len;
fd = open(path, O_RDONLY);
if (fd < 0)
return -1;
- len = strbuf_read(sb, fd, 0);
+ len = strbuf_read(sb, fd, hint);
close(fd);
if (len < 0)
return -1;