From a30adad428d467fd46b1df199223b0d7af2d53a4 Mon Sep 17 00:00:00 2001 From: "Sven M. Hallberg" <pesco@khjk.org> Date: Thu, 22 Sep 2022 18:47:59 +0200 Subject: [PATCH] remove an unreachable case Replace it with an assert. This case could never occur because it tests precisely the loop condition and there are no break statements in the loop. This was the only use of the 'err' label, so that can go. The code under it remains the fall-through case for 'err0', i.e. the actual error (parse failure) case. --- src/parsers/many.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/parsers/many.c b/src/parsers/many.c index 655dd149..2da84c01 100644 --- a/src/parsers/many.c +++ b/src/parsers/many.c @@ -30,8 +30,7 @@ static HParseResult *parse_many(void* env, HParseState *state) { h_carray_append(seq, (void*)elem->ast); count++; } - if (count < env_->count) - goto err; + assert(count == env_->count); succ: ; // necessary for the label to be here... HParsedToken *res = a_new(HParsedToken, 1); @@ -46,7 +45,6 @@ static HParseResult *parse_many(void* env, HParseState *state) { state->input_stream = bak; goto succ; } - err: state->input_stream = bak; return NULL; } -- GitLab