Use POSIX setvbuf in preference to BSD setlinebuf.
authorYann Dirson <ydirson@free.fr>
Thu, 5 Dec 2013 22:13:44 +0000 (23:13 +0100)
committerYann Dirson <ydirson@free.fr>
Thu, 5 Dec 2013 22:13:44 +0000 (23:13 +0100)
This avoids implicit declaration of setlinebuf with GNU libc, which would
have required to define _BSD_SOURCE just to get rid of, and is not an
innocuous setting.

Drop call to no-op AC_FUNC_SETVBUF_REVERSED at the same time.

configure.ac
gnushogi/rawdsp.c

index bae9d3d..923ec35 100644 (file)
@@ -103,12 +103,11 @@ AC_MSG_NOTICE([library functions])
 AC_FUNC_FORK
 AC_PROG_GCC_TRADITIONAL
 AC_FUNC_MALLOC
-AC_FUNC_SETVBUF_REVERSED
 AC_TYPE_SIGNAL
 AC_CHECK_FUNCS([dup2 gethostname gettimeofday memset pow strcasecmp])
 AC_CHECK_FUNCS([strchr strerror strrchr strstr strtol])
 AC_CHECK_FUNCS([memcpy bcopy])
-AC_CHECK_FUNCS([setlinebuf setvbuf])
+AC_CHECK_FUNCS([setvbuf setlinebuf])
 
 
 #
index 5c4d45d..8337d41 100644 (file)
@@ -223,13 +223,13 @@ Raw_Initialize(void)
         /* needed because of inconsistency between MSVC run-time system and gcc includes */
         setbuf(stdout, NULL);
 #else
-#ifdef HAVE_SETLINEBUF
-        setlinebuf(stdout);
-#else
-#  ifdef HAVE_SETVBUF
+#ifdef HAVE_SETVBUF
         setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
+#else
+#  ifdef HAVE_SETLINEBUF
+        setlinebuf(stdout);
 #  else
-#    error "Need setlinebuf() or setvbuf() to compile gnushogi!"
+#    error "Need setvbuf() or setlinebuf() to compile gnushogi!"
 #  endif
 #endif
 #endif