Moved some more compiler/OS-specific stuff to compiler.h

This commit is contained in:
William Kendrick 2006-02-19 06:22:26 +00:00
parent f8827bf5e9
commit ce30f735f1
2 changed files with 38 additions and 36 deletions

View file

@ -24,10 +24,47 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
June 14, 2002 - February 17, 2006
June 14, 2002 - February 18, 2006
$Id$
*/
#ifdef WIN32
/*
The SDL stderr redirection trick doesn't seem to work for perror().
This does pretty much the same thing.
*/
static void win32_perror(const char * const str)
{
if ( str && *str )
fprintf(stderr,"%s : ",str);
fprintf(stderr,
"%s [%d]\n",
(errno<_sys_nerr)?_sys_errlist[errno]:"unknown",errno );
}
#define perror win32_perror
/*
MinGW implementation of isspace() crashes on some Win98 boxes
if c is 'out-of-range'.
*/
static int win32_isspace(int c)
{
return (c == 0x20) || (c >= 0x09 && c <= 0x0D);
}
#define isspace win32_isspace
/*
WIN32 and MINGW don't have strcasestr().
*/
#define NOMINMAX
#include "Shlwapi.h"
#define strcasestr StrStrI
#endif /* WIN32 */
#ifdef __GNUC__
// This version has strict type checking for safety.
// See the "unnecessary" pointer comparison. (from Linux)
@ -118,4 +155,3 @@
#define CLOCK_ASM(x) x=42
#endif

View file

@ -358,40 +358,6 @@ static int font_socket_fd;
#include "malloc.c"
#endif
#ifdef WIN32
/*
The SDL stderr redirection trick doesn't seem to work for perror().
This does pretty much the same thing.
*/
static void win32_perror(const char * const str)
{
if ( str && *str )
fprintf(stderr,"%s : ",str);
fprintf(stderr,
"%s [%d]\n",
(errno<_sys_nerr)?_sys_errlist[errno]:"unknown",errno );
}
#define perror win32_perror
/*
MinGW implementation of isspace() crashes on some Win98 boxes
if c is 'out-of-range'.
*/
static int win32_isspace(int c)
{
return (c == 0x20) || (c >= 0x09 && c <= 0x0D);
}
#define isspace win32_isspace
/*
WIN32 and MINGW don't have strcasestr().
*/
#define NOMINMAX
#include "Shlwapi.h"
#define strcasestr StrStrI
#endif /* WIN32 */
#include "compiler.h"