mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-03 17:24:29 +00:00 
			
		
		
		
	Merge pull request #4015 from Pyrohh/os_defs_more
[RFC] Misc. macro cleanup
This commit is contained in:
		@@ -2729,13 +2729,6 @@ void fast_breakcheck(void)
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef SEEK_SET
 | 
					 | 
				
			||||||
# define SEEK_SET 0
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
#ifndef SEEK_END
 | 
					 | 
				
			||||||
# define SEEK_END 2
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Get the stdout of an external command.
 | 
					 * Get the stdout of an external command.
 | 
				
			||||||
 * If "ret_len" is NULL replace NUL characters with NL.  When "ret_len" is not
 | 
					 * If "ret_len" is NULL replace NUL characters with NL.  When "ret_len" is not
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -837,9 +837,10 @@ set_option_default (
 | 
				
			|||||||
    } else {  /* P_BOOL */
 | 
					    } else {  /* P_BOOL */
 | 
				
			||||||
      *(int *)varp = (int)(intptr_t)options[opt_idx].def_val[dvi];
 | 
					      *(int *)varp = (int)(intptr_t)options[opt_idx].def_val[dvi];
 | 
				
			||||||
#ifdef UNIX
 | 
					#ifdef UNIX
 | 
				
			||||||
      /* 'modeline' defaults to off for root */
 | 
					      // 'modeline' defaults to off for root
 | 
				
			||||||
      if (options[opt_idx].indir == PV_ML && getuid() == ROOT_UID)
 | 
					      if (options[opt_idx].indir == PV_ML && getuid() == 0) {
 | 
				
			||||||
        *(int *)varp = FALSE;
 | 
					        *(int *)varp = false;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
      /* May also set global value for local option. */
 | 
					      /* May also set global value for local option. */
 | 
				
			||||||
      if (both)
 | 
					      if (both)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,28 +34,6 @@
 | 
				
			|||||||
# define DFLT_MAXMEMTOT (10*1024)
 | 
					# define DFLT_MAXMEMTOT (10*1024)
 | 
				
			||||||
#endif
 | 
					#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
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Note: Some systems need both string.h and strings.h (Savage).  However,
 | 
					// Note: Some systems need both string.h and strings.h (Savage).  However,
 | 
				
			||||||
// some systems can't handle both, only use string.h in that case.
 | 
					// some systems can't handle both, only use string.h in that case.
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,4 +50,26 @@ typedef SSIZE_T ssize_t;
 | 
				
			|||||||
# endif
 | 
					# endif
 | 
				
			||||||
#endif
 | 
					#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
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif  // NVIM_OS_WIN_DEFS_H
 | 
					#endif  // NVIM_OS_WIN_DEFS_H
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -175,13 +175,6 @@ void mch_exit(int r)
 | 
				
			|||||||
  exit(r);
 | 
					  exit(r);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef SEEK_SET
 | 
					 | 
				
			||||||
# define SEEK_SET 0
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
#ifndef SEEK_END
 | 
					 | 
				
			||||||
# define SEEK_END 2
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define SHELL_SPECIAL (char_u *)"\t \"&'$;<>()\\|"
 | 
					#define SHELL_SPECIAL (char_u *)"\t \"&'$;<>()\\|"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// Does wildcard pattern matching using the shell.
 | 
					/// Does wildcard pattern matching using the shell.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3082,8 +3082,8 @@ shada_write_file_nomerge: {}
 | 
				
			|||||||
      // viminfo file that the user can't read.
 | 
					      // viminfo file that the user can't read.
 | 
				
			||||||
      FileInfo old_info;
 | 
					      FileInfo old_info;
 | 
				
			||||||
      if (os_fileinfo((char *)fname, &old_info)) {
 | 
					      if (os_fileinfo((char *)fname, &old_info)) {
 | 
				
			||||||
        if (getuid() == ROOT_UID) {
 | 
					        if (getuid() == 0) {
 | 
				
			||||||
          if (old_info.stat.st_uid != ROOT_UID
 | 
					          if (old_info.stat.st_uid != 0
 | 
				
			||||||
              || old_info.stat.st_gid != getgid()) {
 | 
					              || old_info.stat.st_gid != getgid()) {
 | 
				
			||||||
            const uv_uid_t old_uid = (uv_uid_t) old_info.stat.st_uid;
 | 
					            const uv_uid_t old_uid = (uv_uid_t) old_info.stat.st_uid;
 | 
				
			||||||
            const uv_gid_t old_gid = (uv_gid_t) old_info.stat.st_gid;
 | 
					            const uv_gid_t old_gid = (uv_gid_t) old_info.stat.st_gid;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,9 +27,6 @@ Error: configure did not run properly.Check auto/config.log.
 | 
				
			|||||||
# endif
 | 
					# endif
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* user ID of root is usually zero, but not for everybody */
 | 
					 | 
				
			||||||
#define ROOT_UID 0
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Can't use "PACKAGE" here, conflicts with a Perl include file. */
 | 
					/* Can't use "PACKAGE" here, conflicts with a Perl include file. */
 | 
				
			||||||
#ifndef VIMPACKAGE
 | 
					#ifndef VIMPACKAGE
 | 
				
			||||||
@@ -232,15 +229,6 @@ enum {
 | 
				
			|||||||
/* Size in bytes of the hash used in the undo file. */
 | 
					/* Size in bytes of the hash used in the undo file. */
 | 
				
			||||||
#define UNDO_HASH_SIZE 32
 | 
					#define UNDO_HASH_SIZE 32
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef HAVE_FCNTL_H
 | 
					 | 
				
			||||||
# include <fcntl.h>
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifndef O_NOFOLLOW
 | 
					 | 
				
			||||||
# define O_NOFOLLOW 0
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * defines to avoid typecasts from (char_u *) to (char *) and back
 | 
					 * defines to avoid typecasts from (char_u *) to (char *) and back
 | 
				
			||||||
 * (vim_strchr() and vim_strrchr() are now in alloc.c)
 | 
					 * (vim_strchr() and vim_strrchr() are now in alloc.c)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user