From c6c41e85b2992bba41cac23ac8bab32e29553e84 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 26 Feb 2014 12:27:56 -0300 Subject: more uniformity for defining system-dependent features --- liolib.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'liolib.c') diff --git a/liolib.c b/liolib.c index fddbf0cc..88be99ec 100644 --- a/liolib.c +++ b/liolib.c @@ -1,5 +1,5 @@ /* -** $Id: liolib.c,v 2.115 2014/01/27 13:28:45 roberto Exp roberto $ +** $Id: liolib.c,v 2.116 2014/02/21 14:39:50 roberto Exp roberto $ ** Standard I/O (and system) library ** See Copyright Notice in lua.h */ @@ -51,29 +51,30 @@ ** ======================================================= */ -#if !defined(lua_popen) /* { */ +#if !defined(lua_popen) /* { */ -#if defined(LUA_USE_POPEN) /* { */ +#if defined(LUA_USE_POSIX) /* { */ -#define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m)) -#define lua_pclose(L,file) ((void)L, pclose(file)) +#define lua_popen(L,c,m) (fflush(NULL), popen(c,m)) +#define lua_pclose(L,file) (pclose(file)) #elif defined(LUA_WIN) /* }{ */ -#define lua_popen(L,c,m) ((void)L, _popen(c,m)) -#define lua_pclose(L,file) ((void)L, _pclose(file)) - +#define lua_popen(L,c,m) (_popen(c,m)) +#define lua_pclose(L,file) (_pclose(file)) #else /* }{ */ -#define lua_popen(L,c,m) ((void)((void)c, m), \ - luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0) +/* ANSI definitions */ +#define lua_popen(L,c,m) \ + ((void)((void)c, m), \ + luaL_error(L, LUA_QL("popen") " not supported"), \ + (FILE*)0) #define lua_pclose(L,file) ((void)((void)L, file), -1) - #endif /* } */ -#endif /* } */ +#endif /* } */ /* }====================================================== */ @@ -84,7 +85,7 @@ ** ======================================================= */ -#if !defined(lua_fseek) && !defined(LUA_ANSI) /* { */ +#if !defined(lua_fseek) /* { */ #if defined(LUA_USE_POSIX) /* { */ @@ -94,22 +95,22 @@ #elif defined(LUA_WIN) && !defined(_CRTIMP_TYPEINFO) \ && defined(_MSC_VER) && (_MSC_VER >= 1400) /* }{ */ -/* Windows (but not DDK) and Visual C++ 2005 or higher */ +/* Windows (but not DDK) and Visual C++ 2005 or higher */ #define l_fseek(f,o,w) _fseeki64(f,o,w) #define l_ftell(f) _ftelli64(f) #define l_seeknum __int64 -#endif /* } */ - -#endif /* } */ - +#else /* }{ */ -#if !defined(l_fseek) /* default definitions */ +/* ANSI definitions */ #define l_fseek(f,o,w) fseek(f,o,w) #define l_ftell(f) ftell(f) #define l_seeknum long -#endif + +#endif /* } */ + +#endif /* } */ /* }====================================================== */ -- cgit v1.2.3-55-g6feb