X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=strbuf.c;h=e33d06b87c978ad7484c9d6bf972681c3d6cdeb0;hb=a2f8028d3d661b314d5a784764f2f5f9e4c2dde0;hp=d381c1d95bec4873bff07c97ebee9c4fc3f3d980;hpb=812666c8e66a21e668c0789d0422aa5a7db54961;p=git.git diff --git a/strbuf.c b/strbuf.c index d381c1d95..e33d06b87 100644 --- a/strbuf.c +++ b/strbuf.c @@ -1,10 +1,8 @@ -#include -#include -#include "strbuf.h" #include "cache.h" +#include "strbuf.h" void strbuf_init(struct strbuf *sb) { - sb->buf = 0; + sb->buf = NULL; sb->eof = sb->alloc = sb->len = 0; } @@ -37,8 +35,7 @@ void read_line(struct strbuf *sb, FILE *fp, int term) { break; strbuf_add(sb, ch); } - if (sb->len == 0) + if (ch == EOF && sb->len == 0) sb->eof = 1; strbuf_end(sb); } -