diff options
author | tamago324 <tamago_pad@yahoo.co.jp> | 2020-11-07 07:59:28 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-06 17:59:28 -0500 |
commit | 40a742725ccd472038685ccb99090ee2a6b2c912 (patch) | |
tree | 5535f53a5c1eec847bad0d956e332b7564e06820 /src/nvim/os | |
parent | d17e508796be60eefe4a597df62de1fd9e7e1725 (diff) | |
download | rneovim-40a742725ccd472038685ccb99090ee2a6b2c912.tar.gz rneovim-40a742725ccd472038685ccb99090ee2a6b2c912.tar.bz2 rneovim-40a742725ccd472038685ccb99090ee2a6b2c912.zip |
vim-patch:8.1.0268: file type checking has too many #ifdef (#13182)
Problem: File type checking has too many #ifdef.
Solution: Always define the S_IF macros. (Ken Takata, closes vim/vim#3306)
https://github.com/vim/vim/commit/d569bb029983cff947dce704e6f830276204c13f
Diffstat (limited to 'src/nvim/os')
-rw-r--r-- | src/nvim/os/os_defs.h | 51 | ||||
-rw-r--r-- | src/nvim/os/win_defs.h | 22 |
2 files changed, 51 insertions, 22 deletions
diff --git a/src/nvim/os/os_defs.h b/src/nvim/os/os_defs.h index bd5f2b889d..1b7859b0d3 100644 --- a/src/nvim/os/os_defs.h +++ b/src/nvim/os/os_defs.h @@ -45,4 +45,55 @@ # define os_strtok strtok_r #endif +// stat macros +#ifndef S_ISDIR +# ifdef S_IFDIR +# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +# else +# define S_ISDIR(m) 0 +# endif +#endif +#ifndef S_ISREG +# ifdef S_IFREG +# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +# else +# define S_ISREG(m) 0 +# endif +#endif +#ifndef S_ISBLK +# ifdef S_IFBLK +# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) +# else +# define S_ISBLK(m) 0 +# endif +#endif +#ifndef S_ISSOCK +# ifdef S_IFSOCK +# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) +# else +# define S_ISSOCK(m) 0 +# endif +#endif +#ifndef S_ISFIFO +# ifdef S_IFIFO +# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) +# else +# define S_ISFIFO(m) 0 +# endif +#endif +#ifndef S_ISCHR +# ifdef S_IFCHR +# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) +# else +# define S_ISCHR(m) 0 +# endif +#endif +#ifndef S_ISLNK +# ifdef S_IFLNK +# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) +# else +# define S_ISLNK(m) 0 +# endif +#endif + #endif // NVIM_OS_OS_DEFS_H diff --git a/src/nvim/os/win_defs.h b/src/nvim/os/win_defs.h index 356094baa1..66d72de08d 100644 --- a/src/nvim/os/win_defs.h +++ b/src/nvim/os/win_defs.h @@ -74,28 +74,6 @@ typedef int mode_t; # define O_NOFOLLOW 0 #endif -#if !defined(S_ISDIR) && defined(S_IFDIR) -# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -#endif -#if !defined(S_ISREG) && defined(S_IFREG) -# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) -#endif -#if !defined(S_ISLNK) && defined(S_IFLNK) -# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) -#endif -#if !defined(S_ISBLK) && defined(S_IFBLK) -# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) -#endif -#if !defined(S_ISSOCK) && defined(S_IFSOCK) -# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) -#endif -#if !defined(S_ISFIFO) && defined(S_IFIFO) -# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) -#endif -#if !defined(S_ISCHR) && defined(S_IFCHR) -# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) -#endif - #ifndef STDIN_FILENO # define STDIN_FILENO 0 #endif |