Browse Source

small problems with 'luaone.c'

Roberto Ierusalimschy 14 năm trước cách đây
mục cha
commit
98816d0ce5
5 tập tin đã thay đổi với 16 bổ sung11 xóa
  1. 2 2
      lbaselib.c
  2. 3 3
      llimits.h
  3. 6 1
      lobject.h
  4. 3 3
      ltm.c
  5. 2 2
      ltm.h

+ 2 - 2
lbaselib.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lbaselib.c,v 1.258 2011/01/07 12:41:48 roberto Exp roberto $
+** $Id: lbaselib.c,v 1.259 2011/01/26 16:30:02 roberto Exp roberto $
 ** Basic library
 ** Basic library
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -395,7 +395,7 @@ static int luaB_select (lua_State *L) {
 
 
 
 
 static int pcallcont (lua_State *L) {
 static int pcallcont (lua_State *L) {
-  int errfunc;  /* call has an error function in bottom of the stack */
+  int errfunc = 0;  /* =0 to avoid warnings */
   int status = lua_getctx(L, &errfunc);
   int status = lua_getctx(L, &errfunc);
   lua_assert(status != LUA_OK);
   lua_assert(status != LUA_OK);
   lua_pushboolean(L, (status == LUA_YIELD));  /* first result (status) */
   lua_pushboolean(L, (status == LUA_YIELD));  /* first result (status) */

+ 3 - 3
llimits.h

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: llimits.h,v 1.86 2010/12/23 15:38:28 roberto Exp roberto $
+** $Id: llimits.h,v 1.87 2011/02/01 16:52:38 roberto Exp roberto $
 ** Limits, basic types, and some other `installation-dependent' definitions
 ** Limits, basic types, and some other `installation-dependent' definitions
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -250,7 +250,7 @@ union luai_Cast { double l_d; LUA_INT32 l_p[2]; };
 
 
 
 
 
 
-#if defined(ltable_c) && !defined(luai_hashnum)		/* { */
+#if (defined(ltable_c) || defined(luaall_c)) && !defined(luai_hashnum)
 
 
 #include <float.h>
 #include <float.h>
 #include <math.h>
 #include <math.h>
@@ -259,7 +259,7 @@ union luai_Cast { double l_d; LUA_INT32 l_p[2]; };
   n = frexp(n, &e) * (lua_Number)(INT_MAX - DBL_MAX_EXP);  \
   n = frexp(n, &e) * (lua_Number)(INT_MAX - DBL_MAX_EXP);  \
   lua_number2int(i, n); i += e; }
   lua_number2int(i, n); i += e; }
 
 
-#endif							/* } */
+#endif
 
 
 
 
 
 

+ 6 - 1
lobject.h

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lobject.h,v 2.45 2010/12/10 14:53:15 roberto Exp roberto $
+** $Id: lobject.h,v 2.46 2011/01/07 15:46:27 roberto Exp roberto $
 ** Type definitions for Lua objects
 ** Type definitions for Lua objects
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -23,6 +23,11 @@
 #define LUA_TUPVAL	(LUA_NUMTAGS+1)
 #define LUA_TUPVAL	(LUA_NUMTAGS+1)
 #define LUA_TDEADKEY	(LUA_NUMTAGS+2)
 #define LUA_TDEADKEY	(LUA_NUMTAGS+2)
 
 
+/*
+** number of all possible tags (including LUA_TNONE but excluding DEADKEY)
+*/
+#define LUA_TOTALTAGS	(LUA_TUPVAL+2)
+
 
 
 /*
 /*
 ** Variant tag for light C functions (negative to be considered
 ** Variant tag for light C functions (negative to be considered

+ 3 - 3
ltm.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: ltm.c,v 2.11 2010/01/13 16:18:25 roberto Exp roberto $
+** $Id: ltm.c,v 2.12 2010/04/13 20:48:12 roberto Exp roberto $
 ** Tag methods
 ** Tag methods
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -21,11 +21,11 @@
 
 
 static const char udatatypename[] = "userdata";
 static const char udatatypename[] = "userdata";
 
 
-LUAI_DDEF const char *const luaT_typenames_[] = {
+LUAI_DDEF const char *const luaT_typenames_[LUA_TOTALTAGS] = {
   "no value",
   "no value",
   "nil", "boolean", udatatypename, "number",
   "nil", "boolean", udatatypename, "number",
   "string", "table", "function", udatatypename, "thread",
   "string", "table", "function", udatatypename, "thread",
-  "proto", "upval"
+  "proto", "upval"  /* these last two cases are used for tests only */
 };
 };
 
 
 
 

+ 2 - 2
ltm.h

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: ltm.h,v 2.9 2010/01/13 16:18:25 roberto Exp roberto $
+** $Id: ltm.h,v 2.10 2010/04/13 20:48:12 roberto Exp roberto $
 ** Tag methods
 ** Tag methods
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -46,7 +46,7 @@ typedef enum {
 #define ttypename(x)	luaT_typenames_[(x) + 1]
 #define ttypename(x)	luaT_typenames_[(x) + 1]
 #define objtypename(x)	ttypename(ttypenv(x))
 #define objtypename(x)	ttypename(ttypenv(x))
 
 
-LUAI_DDEC const char *const luaT_typenames_[];
+LUAI_DDEC const char *const luaT_typenames_[LUA_TOTALTAGS];
 
 
 
 
 LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename);
 LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename);