Skip to content

code optimization #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions source/ff.c
Original file line number Diff line number Diff line change
Expand Up @@ -652,15 +652,15 @@ static QWORD ld_qword (const BYTE* ptr) /* Load an 8-byte little-endian word */
static void st_word (BYTE* ptr, WORD val) /* Store a 2-byte word in little-endian */
{
*ptr++ = (BYTE)val; val >>= 8;
*ptr++ = (BYTE)val;
*ptr = (BYTE)val;
}

static void st_dword (BYTE* ptr, DWORD val) /* Store a 4-byte word in little-endian */
{
*ptr++ = (BYTE)val; val >>= 8;
*ptr++ = (BYTE)val; val >>= 8;
*ptr++ = (BYTE)val; val >>= 8;
*ptr++ = (BYTE)val;
*ptr = (BYTE)val;
}

#if FF_FS_EXFAT
Expand All @@ -673,7 +673,7 @@ static void st_qword (BYTE* ptr, QWORD val) /* Store an 8-byte word in little-en
*ptr++ = (BYTE)val; val >>= 8;
*ptr++ = (BYTE)val; val >>= 8;
*ptr++ = (BYTE)val; val >>= 8;
*ptr++ = (BYTE)val;
*ptr = (BYTE)val;
}
#endif
#endif /* !FF_FS_READONLY */
Expand Down Expand Up @@ -1910,7 +1910,7 @@ static int pick_lfn ( /* 1:succeeded, 0:buffer overflow or invalid LFN entry */
}
}

if (dir[LDIR_Ord] & LLEF && wc != 0) { /* Put terminator if it is the last LFN part and not terminated */
if ((dir[LDIR_Ord] & LLEF) && wc != 0) { /* Put terminator if it is the last LFN part and not terminated */
if (i >= FF_MAX_LFN + 1) return 0; /* Buffer overflow? */
lfnbuf[i] = 0;
}
Expand Down Expand Up @@ -5047,9 +5047,9 @@ FRESULT f_mkdir (
dj.dir[DIR_Attr] = AM_DIR; /* Attribute */
fs->wflag = 1;
}
if (res == FR_OK) {
//removed duplicate condition (res == FR_OK)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for comment here.

Suggested change
//removed duplicate condition (res == FR_OK)

res = sync_fs(fs);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation.

Suggested change
res = sync_fs(fs);
res = sync_fs(fs);

}

} else {
remove_chain(&sobj, dcl, 0); /* Could not register, remove the allocated cluster */
}
Expand Down