diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-01-19 17:49:22 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-01-19 17:49:22 -0200 |
commit | d49e4dd752928c5869a75c444b503060b2634968 (patch) | |
tree | 4e13ace68c6940dd12efae1014b18237e1004caa | |
parent | 981fddea022b6cad7768223353b4e7386080c271 (diff) | |
download | lua-d49e4dd752928c5869a75c444b503060b2634968.tar.gz lua-d49e4dd752928c5869a75c444b503060b2634968.tar.bz2 lua-d49e4dd752928c5869a75c444b503060b2634968.zip |
MAX_WORD should not be bigger than MAX_INT
-rw-r--r-- | bugs | 11 | ||||
-rw-r--r-- | lbuiltin.c | 6 | ||||
-rw-r--r-- | lgc.c | 4 | ||||
-rw-r--r-- | lobject.h | 13 |
4 files changed, 26 insertions, 8 deletions
@@ -2,3 +2,14 @@ | |||
2 | Tue Dec 2 10:45:48 EDT 1997 | 2 | Tue Dec 2 10:45:48 EDT 1997 |
3 | >> BUG: "lastline" was not reset on function entry, so debug information | 3 | >> BUG: "lastline" was not reset on function entry, so debug information |
4 | >> started only in the 2nd line of a function. | 4 | >> started only in the 2nd line of a function. |
5 | |||
6 | |||
7 | --- Version 3.1 alpha | ||
8 | |||
9 | ** lua.c | ||
10 | Thu Jan 15 14:34:58 EDT 1998 | ||
11 | >> must include "stdlib.h" (for "exit()"). | ||
12 | |||
13 | ** lbuiltin.c / lobject.h | ||
14 | Thu Jan 15 14:34:58 EDT 1998 | ||
15 | >> MAX_WORD may be bigger than MAX_INT | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lbuiltin.c,v 1.21 1998/01/02 17:46:32 roberto Exp roberto $ | 2 | ** $Id: lbuiltin.c,v 1.22 1998/01/07 16:26:48 roberto Exp roberto $ |
3 | ** Built-in functions | 3 | ** Built-in functions |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -263,7 +263,7 @@ static int getnarg (lua_Object table) | |||
263 | lua_Object temp; | 263 | lua_Object temp; |
264 | /* temp = table.n */ | 264 | /* temp = table.n */ |
265 | lua_pushobject(table); lua_pushstring("n"); temp = lua_rawgettable(); | 265 | lua_pushobject(table); lua_pushstring("n"); temp = lua_rawgettable(); |
266 | return (lua_isnumber(temp) ? lua_getnumber(temp) : MAX_WORD); | 266 | return (lua_isnumber(temp) ? lua_getnumber(temp) : MAX_INT); |
267 | } | 267 | } |
268 | 268 | ||
269 | static void luaI_call (void) | 269 | static void luaI_call (void) |
@@ -283,7 +283,7 @@ static void luaI_call (void) | |||
283 | lua_Object temp; | 283 | lua_Object temp; |
284 | /* temp = arg[i+1] */ | 284 | /* temp = arg[i+1] */ |
285 | lua_pushobject(arg); lua_pushnumber(i+1); temp = lua_rawgettable(); | 285 | lua_pushobject(arg); lua_pushnumber(i+1); temp = lua_rawgettable(); |
286 | if (narg == MAX_WORD && lua_isnil(temp)) | 286 | if (narg == MAX_INT && lua_isnil(temp)) |
287 | break; | 287 | break; |
288 | lua_pushobject(temp); | 288 | lua_pushobject(temp); |
289 | } | 289 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 1.14 1997/12/17 20:48:58 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 1.15 1998/01/09 14:44:55 roberto Exp roberto $ |
3 | ** Garbage Collector | 3 | ** Garbage Collector |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -41,7 +41,7 @@ int luaC_ref (TObject *o, int lock) | |||
41 | /* no more empty spaces */ { | 41 | /* no more empty spaces */ { |
42 | int oldSize = L->refSize; | 42 | int oldSize = L->refSize; |
43 | L->refSize = luaM_growvector(&L->refArray, L->refSize, struct ref, | 43 | L->refSize = luaM_growvector(&L->refArray, L->refSize, struct ref, |
44 | refEM, MAX_WORD); | 44 | refEM, MAX_INT); |
45 | for (ref=oldSize; ref<L->refSize; ref++) | 45 | for (ref=oldSize; ref<L->refSize; ref++) |
46 | L->refArray[ref].status = FREE; | 46 | L->refArray[ref].status = FREE; |
47 | ref = oldSize; | 47 | ref = oldSize; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.h,v 1.15 1998/01/13 13:27:25 roberto Exp $ | 2 | ** $Id: lobject.h,v 1.15 1998/01/14 13:48:28 roberto Exp roberto $ |
3 | ** Type definitions for Lua objects | 3 | ** Type definitions for Lua objects |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -25,8 +25,15 @@ | |||
25 | #define Byte lua_Byte /* some systems have Byte as a predefined type */ | 25 | #define Byte lua_Byte /* some systems have Byte as a predefined type */ |
26 | typedef unsigned char Byte; /* unsigned 8 bits */ | 26 | typedef unsigned char Byte; /* unsigned 8 bits */ |
27 | 27 | ||
28 | #define MAX_WORD (65534U) /* maximum value of a word (-2 for safety) */ | 28 | |
29 | #define MAX_INT (INT_MAX-2) /* maximum value of a int (-2 for safety) */ | 29 | #define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */ |
30 | |||
31 | /* maximum value of a word of 2 bytes (-2 for safety); must fit in an "int" */ | ||
32 | #if MAX_INT < 65534 | ||
33 | #define MAX_WORD MAX_INT | ||
34 | #else | ||
35 | #define MAX_WORD 65534 | ||
36 | #endif | ||
30 | 37 | ||
31 | typedef unsigned int IntPoint; /* unsigned with same size as a pointer (for hashing) */ | 38 | typedef unsigned int IntPoint; /* unsigned with same size as a pointer (for hashing) */ |
32 | 39 | ||