mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-07 16:01:30 +00:00
Refactor ff_open()
This commit is contained in:
1 parent
4a5824e7a7
commit
fbf5fa53c6
2 files changed
+4
-4
No files matched your search
+2
-2
@@ -521,8 +521,8 @@ static void ff_list(const char *dir, void (*fn)(const char *, void *),
|
|||||||
|
|
||||||
static void *ff_open(const char *path, int flags) {
|
static void *ff_open(const char *path, int flags) {
|
||||||
FIL f;
|
FIL f;
|
||||||
unsigned char mode =
|
unsigned char mode = FA_READ;
|
||||||
flags == MG_FS_READ ? FA_READ : FA_READ | FA_WRITE | FA_OPEN_APPEND;
|
if (flags & MG_FS_WRITE) mode |= FA_WRITE | FA_CREATE_ALWAYS | FA_OPEN_APPEND;
|
||||||
if (f_open(&f, path, mode) == 0) {
|
if (f_open(&f, path, mode) == 0) {
|
||||||
FIL *fp = calloc(1, sizeof(*fp));
|
FIL *fp = calloc(1, sizeof(*fp));
|
||||||
*fp = f;
|
*fp = f;
|
||||||
|
|||||||
+2
-2
@@ -33,8 +33,8 @@ static void ff_list(const char *dir, void (*fn)(const char *, void *),
|
|||||||
|
|
||||||
static void *ff_open(const char *path, int flags) {
|
static void *ff_open(const char *path, int flags) {
|
||||||
FIL f;
|
FIL f;
|
||||||
unsigned char mode =
|
unsigned char mode = FA_READ;
|
||||||
flags == MG_FS_READ ? FA_READ : FA_READ | FA_WRITE | FA_OPEN_APPEND;
|
if (flags & MG_FS_WRITE) mode |= FA_WRITE | FA_CREATE_ALWAYS | FA_OPEN_APPEND;
|
||||||
if (f_open(&f, path, mode) == 0) {
|
if (f_open(&f, path, mode) == 0) {
|
||||||
FIL *fp = calloc(1, sizeof(*fp));
|
FIL *fp = calloc(1, sizeof(*fp));
|
||||||
*fp = f;
|
*fp = f;
|
||||||
|
|||||||
Reference in new issue
Block a user