From: Michael Stapelberg Date: Mon, 16 Jul 2012 17:23:37 +0000 (+0200) Subject: i3bar: Fix warnings with libyajl1 (Thanks prg) X-Git-Tag: 4.3~191^2^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8f2e225db9c7f18844fec2124546468c6df486d0;p=i3%2Fi3 i3bar: Fix warnings with libyajl1 (Thanks prg) yajl1 has the status yajl_status_insufficient_data, which in our stream parsing context basically means "ok". Therefore, in yajl1, we no longer print an error in this case. --- diff --git a/i3bar/src/child.c b/i3bar/src/child.c index c2be484b..12782caf 100644 --- a/i3bar/src/child.c +++ b/i3bar/src/child.c @@ -210,9 +210,13 @@ void stdin_io_cb(struct ev_loop *loop, ev_io *watcher, int revents) { } if (!plaintext) { yajl_status status = yajl_parse(parser, json_input, rec); +#if YAJL_MAJOR >= 2 if (status != yajl_status_ok) { - fprintf(stderr, "[i3bar] Could not parse JSON input: %.*s\n", - rec, json_input); +#else + if (status != yajl_status_ok && status != yajl_status_insufficient_data) { +#endif + fprintf(stderr, "[i3bar] Could not parse JSON input (code %d): %.*s\n", + status, rec, json_input); } free(buffer); } else {