better use defined/undefined as flag values for macros

This commit is contained in:
Roberto Ierusalimschy 2005-05-20 16:09:05 -03:00
parent f21e9c172f
commit 38da9d568a
4 changed files with 20 additions and 20 deletions

View File

@ -1,5 +1,5 @@
/* /*
** $Id: lauxlib.h,v 1.74 2005/01/10 17:31:50 roberto Exp roberto $ ** $Id: lauxlib.h,v 1.75 2005/03/29 16:20:48 roberto Exp roberto $
** Auxiliary functions for building Lua libraries ** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -15,7 +15,7 @@
#include "lua.h" #include "lua.h"
#if !LUA_COMPAT_GETN #if !defined(LUA_COMPAT_GETN)
#define luaL_getn(L,i) lua_objsize(L, i) #define luaL_getn(L,i) lua_objsize(L, i)
#define luaL_setn(L,i,j) ((void)0) /* no op! */ #define luaL_setn(L,i,j) ((void)0) /* no op! */
#endif #endif

4
ldo.c
View File

@ -1,5 +1,5 @@
/* /*
** $Id: ldo.c,v 2.22 2005/04/05 13:41:29 roberto Exp roberto $ ** $Id: ldo.c,v 2.23 2005/05/03 19:01:17 roberto Exp roberto $
** Stack and Call structure of Lua ** Stack and Call structure of Lua
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -198,7 +198,7 @@ static StkId adjust_varargs (lua_State *L, int nfixargs, int actual,
for (; actual < nfixargs; ++actual) for (; actual < nfixargs; ++actual)
setnilvalue(L->top++); setnilvalue(L->top++);
} }
#if LUA_COMPAT_VARARG #if defined(LUA_COMPAT_VARARG)
if (style != NEWSTYLEVARARG) { /* compatibility with old-style vararg */ if (style != NEWSTYLEVARARG) { /* compatibility with old-style vararg */
int nvar = actual - nfixargs; /* number of extra arguments */ int nvar = actual - nfixargs; /* number of extra arguments */
luaC_checkGC(L); luaC_checkGC(L);

View File

@ -1,5 +1,5 @@
/* /*
** $Id: loadlib.c,v 1.27 2005/05/16 21:19:00 roberto Exp roberto $ ** $Id: loadlib.c,v 1.28 2005/05/17 19:49:15 roberto Exp roberto $
** Dynamic library loader for Lua ** Dynamic library loader for Lua
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
** **
@ -315,7 +315,7 @@ static int loader_Lua (lua_State *L) {
const char *name = luaL_checkstring(L, 1); const char *name = luaL_checkstring(L, 1);
const char *fname = luaL_gsub(L, name, ".", LUA_DIRSEP); const char *fname = luaL_gsub(L, name, ".", LUA_DIRSEP);
const char *path = NULL; const char *path = NULL;
#if LUA_COMPAT_PATH #if defined(LUA_COMPAT_PATH)
/* try first `LUA_PATH' for compatibility */ /* try first `LUA_PATH' for compatibility */
lua_pushstring(L, "LUA_PATH"); lua_pushstring(L, "LUA_PATH");
lua_rawget(L, LUA_GLOBALSINDEX); lua_rawget(L, LUA_GLOBALSINDEX);
@ -508,7 +508,7 @@ LUALIB_API int luaopen_loadlib (lua_State *L) {
lua_setfield(L, -2, "preload"); lua_setfield(L, -2, "preload");
/* create `loadlib' function */ /* create `loadlib' function */
lua_pushcfunction(L, ll_loadlib); lua_pushcfunction(L, ll_loadlib);
#if LUA_COMPAT_LOADLIB #if defined(LUA_COMPAT_LOADLIB)
lua_pushvalue(L, -1); lua_pushvalue(L, -1);
lua_setfield(L, LUA_GLOBALSINDEX, "loadlib"); lua_setfield(L, LUA_GLOBALSINDEX, "loadlib");
#endif #endif

View File

@ -1,5 +1,5 @@
/* /*
** $Id: luaconf.h,v 1.49 2005/05/17 19:49:15 roberto Exp roberto $ ** $Id: luaconf.h,v 1.50 2005/05/20 15:53:42 roberto Exp roberto $
** Configuration file for Lua ** Configuration file for Lua
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -257,31 +257,31 @@
/* /*
@@ LUA_COMPAT_GETN controls compatibility with old getn behavior. @@ LUA_COMPAT_GETN controls compatibility with old getn behavior.
** CHANGE it to 1 if you want exact compatibility with the behavior of ** CHANGE it (define it) if you want exact compatibility with the
** setn/getn in Lua 5.0. ** behavior of setn/getn in Lua 5.0.
*/ */
#define LUA_COMPAT_GETN 0 #undef LUA_COMPAT_GETN
/* /*
@@ LUA_COMPAT_PATH controls compatibility about LUA_PATH. @@ LUA_COMPAT_PATH controls compatibility about LUA_PATH.
** CHANGE it to 1 if you want 'require' to look for global LUA_PATH ** CHANGE it (define it) if you want 'require' to look for global
** before checking package.path. ** LUA_PATH before checking package.path.
*/ */
#define LUA_COMPAT_PATH 0 #undef LUA_COMPAT_PATH
/* /*
@@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib. @@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib.
** CHANGE it to 1 if you want a global 'loadlib' function (otherwise ** CHANGE it to undefined as soon as you do not need a global 'loadlib'
** the function is only available as 'package.loadlib'). ** function (the function is still available as 'package.loadlib').
*/ */
#define LUA_COMPAT_LOADLIB 1 #define LUA_COMPAT_LOADLIB
/* /*
@@ LUA_COMPAT_VARARG controls compatibility with old vararg feature. @@ LUA_COMPAT_VARARG controls compatibility with old vararg feature.
** CHANGE it to 1 if you want vararg functions that do not use '...' ** CHANGE it to undefined as soon as your programs use '...' to access
** to get an 'arg' table with their extra arguments. ** vararg parameters (instead of the old 'arg' table).
*/ */
#define LUA_COMPAT_VARARG 1 #define LUA_COMPAT_VARARG
/* /*
@@ LUA_COMPAT_LSTR controls compatibility with old long string nesting @@ LUA_COMPAT_LSTR controls compatibility with old long string nesting