Merge pull request #22056 from lewis6991/refactor/fileio_more

refactor `fileio.c`
This commit is contained in:
Lewis Russell 2023-02-15 16:45:20 +00:00 committed by GitHub
commit f006313e95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 998 additions and 934 deletions

File diff suppressed because it is too large Load Diff

View File

@ -783,6 +783,7 @@ int os_setperm(const char *const name, int perm)
# ifdef HAVE_SYS_ACCESS_H # ifdef HAVE_SYS_ACCESS_H
# include <sys/access.h> # include <sys/access.h>
# endif # endif
#endif
// Return a pointer to the ACL of file "fname" in allocated memory. // Return a pointer to the ACL of file "fname" in allocated memory.
// Return NULL if the ACL is not available for whatever reason. // Return NULL if the ACL is not available for whatever reason.
@ -806,7 +807,6 @@ void os_free_acl(vim_acl_T aclent)
return; return;
} }
} }
#endif
#ifdef UNIX #ifdef UNIX
/// Checks if the current user owns a file. /// Checks if the current user owns a file.

View File

@ -13,6 +13,12 @@
# include "nvim/os/unix_defs.h" # include "nvim/os/unix_defs.h"
#endif #endif
#ifdef BACKSLASH_IN_FILENAME
# define BACKSLASH_IN_FILENAME_BOOL true
#else
# define BACKSLASH_IN_FILENAME_BOOL false
#endif
#if !defined(NAME_MAX) && defined(_XOPEN_NAME_MAX) #if !defined(NAME_MAX) && defined(_XOPEN_NAME_MAX)
# define NAME_MAX _XOPEN_NAME_MAX # define NAME_MAX _XOPEN_NAME_MAX
#endif #endif

View File

@ -1339,14 +1339,12 @@ write_error:
semsg(_("E829: write error in undo file: %s"), file_name); semsg(_("E829: write error in undo file: %s"), file_name);
} }
#ifdef HAVE_ACL
if (buf->b_ffname != NULL) { if (buf->b_ffname != NULL) {
// For systems that support ACL: get the ACL from the original file. // For systems that support ACL: get the ACL from the original file.
vim_acl_T acl = os_get_acl(buf->b_ffname); vim_acl_T acl = os_get_acl(buf->b_ffname);
os_set_acl(file_name, acl); os_set_acl(file_name, acl);
os_free_acl(acl); os_free_acl(acl);
} }
#endif
theend: theend:
if (file_name != name) { if (file_name != name) {