summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZephiles <cae222@yahoo.com>2021-05-23 00:03:49 -0500
committerZephiles <cae222@yahoo.com>2021-05-23 00:03:49 -0500
commit10b69b3b411801e520a3f9e755b80ebe71b987c4 (patch)
tree02e24c50ef54358118b111fa3b35d494aa14f7a2
parent5b7ba28fae46c2d4acb97b35d05982d858ccfd12 (diff)
__CARDGetFileNo - Remove nested conditionals
This just makes the code cleaner.
-rw-r--r--src/card.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/card.c b/src/card.c
index 591a013..4afbe17 100644
--- a/src/card.c
+++ b/src/card.c
@@ -68,12 +68,17 @@ int32_t __CARDGetFileNo(void* card, const char* fileName, int32_t* fileNo) {
for (i = 0; i < 127; i++)
{
uint8_t* currentDirBlock = (uint8_t*)(dirBlock + (i * 0x40));
- if (__CARDCompareFileName(currentDirBlock, fileName)) {
- if (__CARDAccess(card, currentDirBlock) >= Ready) {
- *fileNo = i;
- break;
- }
+
+ if (!__CARDCompareFileName(currentDirBlock, fileName)) {
+ continue;
+ }
+
+ if (__CARDAccess(card, currentDirBlock) < Ready) {
+ continue;
}
+
+ *fileNo = i;
+ break;
}
if (i >= 127) {