Browse Source

better use defined/undefined as flag values for macros

Roberto Ierusalimschy 20 years ago
parent
commit
38da9d568a
4 changed files with 20 additions and 20 deletions
  1. 2 2
      lauxlib.h
  2. 2 2
      ldo.c
  3. 3 3
      loadlib.c
  4. 13 13
      luaconf.h

+ 2 - 2
lauxlib.h

@@ -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
 ** See Copyright Notice in lua.h
 */
@@ -15,7 +15,7 @@
 #include "lua.h"
 
 
-#if !LUA_COMPAT_GETN
+#if !defined(LUA_COMPAT_GETN)
 #define luaL_getn(L,i)          lua_objsize(L, i)
 #define luaL_setn(L,i,j)        ((void)0)  /* no op! */
 #endif

+ 2 - 2
ldo.c

@@ -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
 ** 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)
       setnilvalue(L->top++);
   }
-#if LUA_COMPAT_VARARG
+#if defined(LUA_COMPAT_VARARG)
   if (style != NEWSTYLEVARARG) {  /* compatibility with old-style vararg */
     int nvar = actual - nfixargs;  /* number of extra arguments */
     luaC_checkGC(L);

+ 3 - 3
loadlib.c

@@ -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
 ** 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 *fname = luaL_gsub(L, name, ".", LUA_DIRSEP);
   const char *path = NULL;
-#if LUA_COMPAT_PATH
+#if defined(LUA_COMPAT_PATH)
   /* try first `LUA_PATH' for compatibility */
   lua_pushstring(L, "LUA_PATH");
   lua_rawget(L, LUA_GLOBALSINDEX);
@@ -508,7 +508,7 @@ LUALIB_API int luaopen_loadlib (lua_State *L) {
   lua_setfield(L, -2, "preload");
   /* create `loadlib' function */
   lua_pushcfunction(L, ll_loadlib);
-#if LUA_COMPAT_LOADLIB
+#if defined(LUA_COMPAT_LOADLIB)
   lua_pushvalue(L, -1);
   lua_setfield(L, LUA_GLOBALSINDEX, "loadlib");
 #endif

+ 13 - 13
luaconf.h

@@ -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
 ** See Copyright Notice in lua.h
 */
@@ -257,31 +257,31 @@
 
 /*
 @@ LUA_COMPAT_GETN controls compatibility with old getn behavior.
-** CHANGE it to 1 if you want exact compatibility with the behavior of
-** setn/getn in Lua 5.0.
+** CHANGE it (define it) if you want exact compatibility with the
+** 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.
-** CHANGE it to 1 if you want 'require' to look for global LUA_PATH
-** before checking package.path.
+** CHANGE it (define it) if you want 'require' to look for global
+** LUA_PATH before checking package.path.
 */
-#define LUA_COMPAT_PATH		0
+#undef LUA_COMPAT_PATH
 
 /*
 @@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib.
-** CHANGE it to 1 if you want a global 'loadlib' function (otherwise
-** the function is only available as 'package.loadlib').
+** CHANGE it to undefined as soon as you do not need a global '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.
-** CHANGE it to 1 if you want vararg functions that do not use '...'
-** to get an 'arg' table with their extra arguments.
+** CHANGE it to undefined as soon as your programs use '...' to access
+** 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