Avoid useless loop by moving check to the default case

This commit is contained in:
DidierA 2023-07-19 21:46:20 +02:00
commit 8543db11b5

View file

@ -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:
// 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) {