diff src/os_unix.c @ 14718:cf33c47d66aa v8.1.0371

patch 8.1.0371: argument types for select() may be wrong commit https://github.com/vim/vim/commit/643b6140873e0e6f297df0cbca11bc1ea1f21925 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Sep 12 20:29:09 2018 +0200 patch 8.1.0371: argument types for select() may be wrong Problem: Argument types for select() may be wrong. Solution: Use a configure macro. (Tobias Ulmer)
author Christian Brabandt <cb@256bit.org>
date Wed, 12 Sep 2018 20:30:05 +0200
parents f1b7d308de2f
children 193471015e1a
line wrap: on
line diff
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -18,17 +18,6 @@
  * changed beyond recognition.
  */
 
-/*
- * Some systems have a prototype for select() that has (int *) instead of
- * (fd_set *), which is wrong. This define removes that prototype. We define
- * our own prototype below.
- * Don't use it for the Mac, it causes a warning for precompiled headers.
- * TODO: use a configure check for precompiled headers?
- */
-#if !defined(__APPLE__) && !defined(__TANDEM)
-# define select select_declared_wrong
-#endif
-
 #include "vim.h"
 
 #ifdef FEAT_MZSCHEME
@@ -54,14 +43,9 @@ static int selinux_enabled = -1;
 # endif
 #endif
 
-/*
- * Use this prototype for select, some include files have a wrong prototype
- */
-#ifndef __TANDEM
+#ifdef __BEOS__
 # undef select
-# ifdef __BEOS__
-#  define select	beos_select
-# endif
+# define select	beos_select
 #endif
 
 #ifdef __CYGWIN__
@@ -77,10 +61,6 @@ static int selinux_enabled = -1;
 # endif
 #endif
 
-#if defined(HAVE_SELECT)
-extern int   select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
-#endif
-
 #ifdef FEAT_MOUSE_GPM
 # include <gpm.h>
 /* <linux/keyboard.h> contains defines conflicting with "keymap.h",
@@ -6316,7 +6296,8 @@ select_eintr:
 	if (interrupted != NULL)
 	    *interrupted = FALSE;
 
-	ret = select(maxfd + 1, &rfds, &wfds, &efds, tvp);
+	ret = select(maxfd + 1, SELECT_TYPE_ARG234 &rfds,
+		      SELECT_TYPE_ARG234 &wfds, SELECT_TYPE_ARG234 &efds, tvp);
 	result = ret > 0 && FD_ISSET(fd, &rfds);
 	if (result)
 	    --ret;