From 8543db11b59f34ca120a1e6eea7f5b43adee8dac Mon Sep 17 00:00:00 2001 From: DidierA <1620015+DidierA@users.noreply.github.com> Date: Wed, 19 Jul 2023 21:46:20 +0200 Subject: [PATCH] Avoid useless loop by moving check to the default case --- client/src/cmdhflist.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/client/src/cmdhflist.c b/client/src/cmdhflist.c index eea8378ae..64f885713 100644 --- a/client/src/cmdhflist.c +++ b/client/src/cmdhflist.c @@ -1264,13 +1264,6 @@ void annotateMfPlus(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) { data_size = cmdsize - (data - cmd); } - // Messages for commands that do not need args are treated first - const char *annotation = mfpGetAnnotationForCode(cmd[pos]) ; - if (annotation != NULL) { - snprintf(exp, size, "%s", annotation) ; - break ; - } - switch (cmd[pos]) { case MFP_AUTHENTICATEFIRST: case MFP_AUTHENTICATEFIRST_VARIANT: @@ -1407,7 +1400,13 @@ void annotateMfPlus(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) { break; default: - found_annotation = false; + // Messages for commands that do not need args are treated here + const char *annotation = mfpGetAnnotationForCode(cmd[pos]) ; + if (annotation != NULL) { + snprintf(exp, size, "%s", annotation) ; + } else { + found_annotation = false; + } break; } if (found_annotation) {