From 669911946b277a0b628e1661ed58d76bca8fae6df71044d87650a98a72c4f08e Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Sun, 15 Dec 2024 13:01:05 +0300 Subject: [PATCH] Cover ErrInvalid in switches --- cyac/cmd/print-items/print-items.c | 3 +++ cyac/cmd/print-itered/print-itered.c | 3 +++ cyac/lib/items.c | 1 + 3 files changed, 7 insertions(+) diff --git a/cyac/cmd/print-items/print-items.c b/cyac/cmd/print-items/print-items.c index 230ec59..3b5546c 100644 --- a/cyac/cmd/print-items/print-items.c +++ b/cyac/cmd/print-items/print-items.c @@ -115,6 +115,9 @@ printer( // NOLINT(misc-no-recursion) char *str = NULL; enum YACErr err = YACErrInvalid; switch (item->atom.typ) { + case YACItemInvalid: + fputs("INVALID\n", stdout); + break; case YACItemNIL: fputs("NIL\n", stdout); break; diff --git a/cyac/cmd/print-itered/print-itered.c b/cyac/cmd/print-itered/print-itered.c index 7fcaf54..13ac0fa 100644 --- a/cyac/cmd/print-itered/print-itered.c +++ b/cyac/cmd/print-itered/print-itered.c @@ -65,6 +65,9 @@ myCb( char *hex = NULL; enum YACErr err = YACErrInvalid; switch (atom->typ) { + case YACItemInvalid: + fputs("INVALID\n", stdout); + break; case YACItemEOC: break; case YACItemNIL: diff --git a/cyac/lib/items.c b/cyac/lib/items.c index 278c681..a6c57d5 100644 --- a/cyac/lib/items.c +++ b/cyac/lib/items.c @@ -311,6 +311,7 @@ YACItemsEncode( // NOLINT(misc-no-recursion) bool ok = false; assert(cap >= (*off)); switch (item->atom.typ) { + case YACItemInvalid: case YACItemEOC: return false; case YACItemNIL: -- 2.50.0