From: Yann Dirson Date: Thu, 5 Dec 2013 22:13:44 +0000 (+0100) Subject: Use POSIX setvbuf in preference to BSD setlinebuf. X-Git-Url: http://winboard.nl/cgi-bin?p=gnushogi.git;a=commitdiff_plain;h=d5dcedec28a48ae3b1eb8151eb4f8070ff92b3e4 Use POSIX setvbuf in preference to BSD setlinebuf. 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. --- diff --git a/configure.ac b/configure.ac index bae9d3d..923ec35 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) # diff --git a/gnushogi/rawdsp.c b/gnushogi/rawdsp.c index 5c4d45d..8337d41 100644 --- a/gnushogi/rawdsp.c +++ b/gnushogi/rawdsp.c @@ -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