Skip to content

Commit

Permalink
Remove switch statemnet
Browse files Browse the repository at this point in the history
  • Loading branch information
neithanmo committed Nov 22, 2024
1 parent 89410c3 commit 8015989
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions app/src/apdu_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,22 +305,18 @@ void handleApdu(volatile uint32_t *flags, volatile uint32_t *tx, uint32_t rx) {
if (rx < APDU_MIN_LENGTH) {
THROW(APDU_CODE_WRONG_LENGTH);
}

switch (G_io_apdu_buffer[OFFSET_INS]) {
case INS_GET_VERSION: {
handle_getversion(flags, tx);
break;
}
if (G_io_apdu_buffer[OFFSET_INS] == INS_GET_VERSION) {
handle_getversion(flags, tx);
}
#if defined(APP_TESTING)
case INS_TEST: {
handleTest(flags, tx, rx);
THROW(APDU_CODE_OK);
break;
}
else if (G_io_apdu_buffer[OFFSET_INS] == INS_TEST) {
handleTest(flags, tx, rx);
THROW(APDU_CODE_OK);
}
#endif
default:
zemu_log("ins_not_supported**\n");
THROW(APDU_CODE_INS_NOT_SUPPORTED);
else {
zemu_log("ins_not_supported**\n");
THROW(APDU_CODE_INS_NOT_SUPPORTED);
}
}
CATCH(EXCEPTION_IO_RESET) { THROW(EXCEPTION_IO_RESET); }
Expand Down

0 comments on commit 8015989

Please sign in to comment.