From 52db8000c6e0564e92fdba72687e338dc603e02d Mon Sep 17 00:00:00 2001 From: Stephen Dolan <mu@netsoc.tcd.ie> Date: Thu, 27 Dec 2012 01:57:09 +0000 Subject: [PATCH] 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. --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index fd482122..e18f6fdd 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; }