From: Stephen Dolan Date: Thu, 27 Dec 2012 01:57:09 +0000 (+0000) Subject: Fix an embarassing I/O bug. X-Git-Tag: jq-1.3~55 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=52db8000c6e0564e92fdba72687e338dc603e02d;p=jq Fix an embarassing I/O bug. Pulling some I/O out to a function meant that buf changed from "char buf[4096]" to "char* buf", and "sizeof(buf)" got a lot less interesting. The upshot of this is that jq read input eight bytes at a time, which is not the fastest. --- diff --git a/main.c b/main.c index fd48212..e18f6fd 100644 --- a/main.c +++ b/main.c @@ -135,7 +135,7 @@ static int read_more(char* buf, size_t size) { next_input_idx++; } - if (!fgets(buf, sizeof(buf), current_input)) buf[0] = 0; + if (!fgets(buf, size, current_input)) buf[0] = 0; return 1; }