Merge pull request #4341 from mysterywolf/unlink

[libc][iar][gcc] 优化remove函数
This commit is contained in:
Bernard Xiong 2021-02-15 09:28:48 +08:00 committed by GitHub
commit d1cb9c5d97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 10 deletions

View File

@ -9,16 +9,16 @@
*/ */
#include <rtthread.h> #include <rtthread.h>
#ifdef RT_USING_DFS #ifdef RT_USING_DFS
#include <dfs_file.h> #include <dfs_posix.h>
#endif #endif
#include <yfuns.h> #include <yfuns.h>
#pragma module_name = "?remove" #pragma module_name = "?remove"
int remove(const char *val) int remove(const char *val)
{ {
#ifdef RT_USING_DFS #ifndef RT_USING_DFS
dfs_file_unlink(val); return -1;
#else
return unlink(val);
#endif #endif
return 0;
} }

View File

@ -197,12 +197,9 @@ int
_unlink_r(struct _reent *ptr, const char *file) _unlink_r(struct _reent *ptr, const char *file)
{ {
#ifndef RT_USING_DFS #ifndef RT_USING_DFS
return 0; return -1;
#else #else
int rc; return unlink(file);
rc = unlink(file);
return rc;
#endif #endif
} }