mirror of
https://github.com/neovim/neovim.git
synced 2025-10-15 14:26:07 +00:00
refactor: use CLEAR_FIELD and CLEAR_POINTER macros (#19709)
vim-patch:8.2.0559: clearing a struct is verbose
Problem: Clearing a struct is verbose.
Solution: Define and use CLEAR_FIELD() and CLEAR_POINTER().
a80faa8930
This commit is contained in:
@@ -1051,7 +1051,7 @@ int os_remove(const char *path)
|
||||
bool os_fileinfo(const char *path, FileInfo *file_info)
|
||||
FUNC_ATTR_NONNULL_ARG(2)
|
||||
{
|
||||
memset(file_info, 0, sizeof(*file_info));
|
||||
CLEAR_POINTER(file_info);
|
||||
return os_stat(path, &(file_info->stat)) == kLibuvSuccess;
|
||||
}
|
||||
|
||||
@@ -1063,7 +1063,7 @@ bool os_fileinfo(const char *path, FileInfo *file_info)
|
||||
bool os_fileinfo_link(const char *path, FileInfo *file_info)
|
||||
FUNC_ATTR_NONNULL_ARG(2)
|
||||
{
|
||||
memset(file_info, 0, sizeof(*file_info));
|
||||
CLEAR_POINTER(file_info);
|
||||
if (path == NULL) {
|
||||
return false;
|
||||
}
|
||||
@@ -1087,7 +1087,7 @@ bool os_fileinfo_fd(int file_descriptor, FileInfo *file_info)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
uv_fs_t request;
|
||||
memset(file_info, 0, sizeof(*file_info));
|
||||
CLEAR_POINTER(file_info);
|
||||
fs_loop_lock();
|
||||
bool ok = uv_fs_fstat(&fs_loop,
|
||||
&request,
|
||||
|
Reference in New Issue
Block a user