mirror of https://github.com/rusefi/lua.git
MAX_WORD should not be bigger than MAX_INT
This commit is contained in:
parent
981fddea02
commit
d49e4dd752
11
bugs
11
bugs
|
@ -2,3 +2,14 @@
|
|||
Tue Dec 2 10:45:48 EDT 1997
|
||||
>> BUG: "lastline" was not reset on function entry, so debug information
|
||||
>> started only in the 2nd line of a function.
|
||||
|
||||
|
||||
--- Version 3.1 alpha
|
||||
|
||||
** lua.c
|
||||
Thu Jan 15 14:34:58 EDT 1998
|
||||
>> must include "stdlib.h" (for "exit()").
|
||||
|
||||
** lbuiltin.c / lobject.h
|
||||
Thu Jan 15 14:34:58 EDT 1998
|
||||
>> MAX_WORD may be bigger than MAX_INT
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lbuiltin.c,v 1.21 1998/01/02 17:46:32 roberto Exp roberto $
|
||||
** $Id: lbuiltin.c,v 1.22 1998/01/07 16:26:48 roberto Exp roberto $
|
||||
** Built-in functions
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -263,7 +263,7 @@ static int getnarg (lua_Object table)
|
|||
lua_Object temp;
|
||||
/* temp = table.n */
|
||||
lua_pushobject(table); lua_pushstring("n"); temp = lua_rawgettable();
|
||||
return (lua_isnumber(temp) ? lua_getnumber(temp) : MAX_WORD);
|
||||
return (lua_isnumber(temp) ? lua_getnumber(temp) : MAX_INT);
|
||||
}
|
||||
|
||||
static void luaI_call (void)
|
||||
|
@ -283,7 +283,7 @@ static void luaI_call (void)
|
|||
lua_Object temp;
|
||||
/* temp = arg[i+1] */
|
||||
lua_pushobject(arg); lua_pushnumber(i+1); temp = lua_rawgettable();
|
||||
if (narg == MAX_WORD && lua_isnil(temp))
|
||||
if (narg == MAX_INT && lua_isnil(temp))
|
||||
break;
|
||||
lua_pushobject(temp);
|
||||
}
|
||||
|
|
4
lgc.c
4
lgc.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lgc.c,v 1.14 1997/12/17 20:48:58 roberto Exp roberto $
|
||||
** $Id: lgc.c,v 1.15 1998/01/09 14:44:55 roberto Exp roberto $
|
||||
** Garbage Collector
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -41,7 +41,7 @@ int luaC_ref (TObject *o, int lock)
|
|||
/* no more empty spaces */ {
|
||||
int oldSize = L->refSize;
|
||||
L->refSize = luaM_growvector(&L->refArray, L->refSize, struct ref,
|
||||
refEM, MAX_WORD);
|
||||
refEM, MAX_INT);
|
||||
for (ref=oldSize; ref<L->refSize; ref++)
|
||||
L->refArray[ref].status = FREE;
|
||||
ref = oldSize;
|
||||
|
|
13
lobject.h
13
lobject.h
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lobject.h,v 1.15 1998/01/13 13:27:25 roberto Exp $
|
||||
** $Id: lobject.h,v 1.15 1998/01/14 13:48:28 roberto Exp roberto $
|
||||
** Type definitions for Lua objects
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -25,8 +25,15 @@
|
|||
#define Byte lua_Byte /* some systems have Byte as a predefined type */
|
||||
typedef unsigned char Byte; /* unsigned 8 bits */
|
||||
|
||||
#define MAX_WORD (65534U) /* maximum value of a word (-2 for safety) */
|
||||
#define MAX_INT (INT_MAX-2) /* maximum value of a int (-2 for safety) */
|
||||
|
||||
#define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */
|
||||
|
||||
/* maximum value of a word of 2 bytes (-2 for safety); must fit in an "int" */
|
||||
#if MAX_INT < 65534
|
||||
#define MAX_WORD MAX_INT
|
||||
#else
|
||||
#define MAX_WORD 65534
|
||||
#endif
|
||||
|
||||
typedef unsigned int IntPoint; /* unsigned with same size as a pointer (for hashing) */
|
||||
|
||||
|
|
Loading…
Reference in New Issue