remove this error type - json2tsv - JSON to TSV converter
(HTM) git clone git://git.codemadness.org/json2tsv
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit d8a06e34247a2219a62cb7b0d82218b87d155259
(DIR) parent d9eb13696d70c0d87f13438cd9cb34d34102fb82
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 15 Oct 2019 21:45:52 +0200
remove this error type
input:
]
produces this error, which is unclear anyway.
Diffstat:
M json2tsv.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
---
(DIR) diff --git a/json2tsv.c b/json2tsv.c
@@ -35,7 +35,6 @@ const char *JSON_ERROR_CODEPOINT = "invalid codepoint";
const char *JSON_ERROR_DEPTH = "max node depth reached";
const char *JSON_ERROR_ESCAPE_CHAR = "unknown escape character in string";
const char *JSON_ERROR_INVALID_CHAR = "invalid character in string";
-const char *JSON_ERROR_MEMBER = "member, but not in an object/array";
const char *JSON_ERROR_OBJECT_MEMBER = "object member, but not in an object";
static int showindices = 0; /* -n flag: show indices count for arrays */
@@ -265,12 +264,8 @@ escchr:
cb(nodes, depth + 1, value);
v = 0;
}
- if (!depth) {
- *errstr = JSON_ERROR_MEMBER;
- goto end;
- }
-
- if ((c == ']' && nodes[depth - 1].type != TYPE_ARRAY) ||
+ if (!depth ||
+ (c == ']' && nodes[depth - 1].type != TYPE_ARRAY) ||
(c == '}' && nodes[depth - 1].type != TYPE_OBJECT)) {
*errstr = JSON_ERROR_BALANCE;
goto end;