Address review feedback

This commit is contained in:
2026-07-15 14:12:41 -04:00
parent 09c0fb72ca
commit 6520039dc2
3 changed files with 3 additions and 4 deletions
+1 -1
View File
@@ -67,7 +67,7 @@ void WeaselJsonParser_destroy(WeaselJsonParser *parser);
/** Incrementally parse `len` more bytes starting at `buf`. `buf` may be
* modified. Call with `len` 0 to indicate end of data. `buf` may be null if
* `len` is 0. `len` must not be negative; a negative length is treated as a
* rejected input. */
* rejected input. Returns WeaselJson_NULL if parser is null */
WeaselJsonStatus WeaselJsonParser_parse(WeaselJsonParser *parser, char *buf,
int len);
+1 -2
View File
@@ -331,8 +331,7 @@ TEST_CASE("parse rejects negative length") {
}
TEST_CASE("Calling parse with nullptr doesn't crash") {
char buf[10] = "hello";
REQUIRE(WeaselJsonParser_parse(nullptr, buf, -1) == WeaselJson_NULL);
REQUIRE(WeaselJsonParser_parse(nullptr, nullptr, 0) == WeaselJson_NULL);
}
TEST_CASE("streaming") { testStreaming(json); }
+1 -1
View File
@@ -34,7 +34,7 @@ int main(int argc, char **argv) {
case WeaselJson_OVERFLOW:
return 1;
case WeaselJson_NULL:
fprintf(stderr, "Could not create parser\n");
fprintf(stderr, "parse called with a null parser\n");
return 1;
}
if (l == 0) {