浏览代码

in test mode, debug library is not predefined (to allow testing
'preloadedlibs')

Roberto Ierusalimschy 10 年之前
父节点
当前提交
460968353f
共有 2 个文件被更改,包括 11 次插入3 次删除
  1. 7 2
      linit.c
  2. 4 1
      ltests.h

+ 7 - 2
linit.c

@@ -1,5 +1,5 @@
 /*
-** $Id: linit.c,v 1.34 2014/05/15 19:28:34 roberto Exp roberto $
+** $Id: linit.c,v 1.35 2014/11/02 19:19:04 roberto Exp roberto $
 ** Initialization of libraries for lua.c and other clients
 ** See Copyright Notice in lua.h
 */
@@ -37,8 +37,10 @@ static const luaL_Reg loadedlibs[] = {
   {LUA_OSLIBNAME, luaopen_os},
   {LUA_STRLIBNAME, luaopen_string},
   {LUA_MATHLIBNAME, luaopen_math},
-  {LUA_DBLIBNAME, luaopen_debug},
   {LUA_UTF8LIBNAME, luaopen_utf8},
+#if !defined(LUA_NODEBUGLIB)
+  {LUA_DBLIBNAME, luaopen_debug},
+#endif
 #if defined(LUA_COMPAT_BITLIB)
   {LUA_BITLIBNAME, luaopen_bit32},
 #endif
@@ -50,6 +52,9 @@ static const luaL_Reg loadedlibs[] = {
 ** these libs are preloaded and must be required before used
 */
 static const luaL_Reg preloadedlibs[] = {
+#if defined(LUA_NODEBUGLIB)
+  {LUA_DBLIBNAME, luaopen_debug},
+#endif
   {NULL, NULL}
 };
 

+ 4 - 1
ltests.h

@@ -1,5 +1,5 @@
 /*
-** $Id: ltests.h,v 2.41 2014/11/24 14:56:56 roberto Exp roberto $
+** $Id: ltests.h,v 2.42 2014/11/29 19:45:37 roberto Exp roberto $
 ** Internal Header for Debugging of the Lua Implementation
 ** See Copyright Notice in lua.h
 */
@@ -24,6 +24,9 @@
 #undef LUA_COMPAT_MODULE
 
 
+/* test without preloding debug library */
+#define LUA_NODEBUGLIB
+
 #define LUA_DEBUG