simplify parsejson error checking - tscrape - twitter scraper | |
git clone git://git.codemadness.org/tscrape | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 57259fbc5868fc4c8225640aaca8fd496dd6fc6c | |
parent e386c4bbe4e59ce447c921b9063318e98318c0f1 | |
Author: Hiltjo Posthuma <[email protected]> | |
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(-) | |
--- | |
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() log… | |
for (t = tweets; t; t = t->next) { |