From 7160db054af95a8eef1707929b5a54da1e23340d Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Sat, 15 Jun 2019 13:51:56 -0700 Subject: [PATCH] Avoid case ranges in switch statement Signed-off-by: Michael Forney --- src/quirks.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/quirks.c b/src/quirks.c index 7e66d1cb..38a1a5ff 100644 --- a/src/quirks.c +++ b/src/quirks.c @@ -913,8 +913,13 @@ parse_file(struct quirks_context *ctx, const char *path) section = section_new(path, line); list_append(&ctx->sections, §ion->link); break; - /* entries must start with A-Z */ - case 'A'...'Z': + default: + /* entries must start with A-Z */ + if (line[0] < 'A' && line[0] > 'Z') { + qlog_parser(ctx, "%s:%d: Unexpected line %s\n", + path, lineno, line); + goto out; + } switch (state) { case STATE_SECTION: qlog_parser(ctx, "%s:%d: expected [Section], got %s\n", @@ -949,10 +954,6 @@ parse_file(struct quirks_context *ctx, const char *path) goto out; } break; - default: - qlog_parser(ctx, "%s:%d: Unexpected line %s\n", - path, lineno, line); - goto out; } }