simplify parsejson error checking - tscrape - twitter scraper
(HTM) git clone git://git.codemadness.org/tscrape
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 57259fbc5868fc4c8225640aaca8fd496dd6fc6c
(DIR) parent e386c4bbe4e59ce447c921b9063318e98318c0f1
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 5 Jun 2020 17:16:14 +0200
simplify parsejson error checking
Diffstat:
M tscrape.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
---
(DIR) diff --git a/tscrape.c b/tscrape.c
@@ -415,14 +415,12 @@ main(void)
{
struct tweet *t;
size_t i;
- int r;
if (pledge("stdio", NULL) == -1)
err(1, "pledge");
- r = parsejson(processnodes);
- if (r != 0)
- errx(1, "invalid JSON");
+ if (parsejson(processnodes))
+ errx(2, "invalid JSON");
// TODO: TEST: make sure the last tweet is printed too (addtweet() logic).
for (t = tweets; t; t = t->next) {