aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--llex.c4
-rw-r--r--lobject.c6
-rw-r--r--lobject.h5
-rw-r--r--lstate.h4
-rw-r--r--lundump.c4
-rw-r--r--lvm.c4
6 files changed, 13 insertions, 14 deletions
diff --git a/llex.c b/llex.c
index f0cf7146..83ac742d 100644
--- a/llex.c
+++ b/llex.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: llex.c,v 1.110 2002/09/03 11:57:38 roberto Exp roberto $ 2** $Id: llex.c,v 1.111 2002/09/05 19:45:42 roberto Exp roberto $
3** Lexical Analyzer 3** Lexical Analyzer
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -141,7 +141,7 @@ void luaX_setinput (lua_State *L, LexState *LS, ZIO *z, TString *source) {
141#define EXTRABUFF 128 141#define EXTRABUFF 128
142#define checkbuffer(L, len) \ 142#define checkbuffer(L, len) \
143 if (((len)+10)*sizeof(char) > G(L)->Mbuffsize) \ 143 if (((len)+10)*sizeof(char) > G(L)->Mbuffsize) \
144 luaO_openspace(L, (len)+EXTRABUFF, char) 144 luaO_openspace(L, (len)+EXTRABUFF)
145 145
146#define save(L, c, l) (cast(char *, G(L)->Mbuffer)[l++] = cast(char, c)) 146#define save(L, c, l) (cast(char *, G(L)->Mbuffer)[l++] = cast(char, c))
147#define save_and_next(L, LS, l) (save(L, LS->current, l), next(LS)) 147#define save_and_next(L, LS, l) (save(L, LS->current, l), next(LS))
diff --git a/lobject.c b/lobject.c
index 5845e695..dd8bfe08 100644
--- a/lobject.c
+++ b/lobject.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.c,v 1.86 2002/08/07 14:35:55 roberto Exp roberto $ 2** $Id: lobject.c,v 1.87 2002/09/02 19:54:49 roberto Exp roberto $
3** Some generic functions over Lua objects 3** Some generic functions over Lua objects
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -72,9 +72,9 @@ int luaO_rawequalObj (const TObject *t1, const TObject *t2) {
72} 72}
73 73
74 74
75void *luaO_openspaceaux (lua_State *L, size_t n) { 75char *luaO_openspace (lua_State *L, size_t n) {
76 if (n > G(L)->Mbuffsize) { 76 if (n > G(L)->Mbuffsize) {
77 G(L)->Mbuffer = luaM_realloc(L, G(L)->Mbuffer, G(L)->Mbuffsize, n); 77 luaM_reallocvector(L, G(L)->Mbuffer, G(L)->Mbuffsize, n, char);
78 G(L)->Mbuffsize = n; 78 G(L)->Mbuffsize = n;
79 } 79 }
80 return G(L)->Mbuffer; 80 return G(L)->Mbuffer;
diff --git a/lobject.h b/lobject.h
index f80acfee..d9a5c242 100644
--- a/lobject.h
+++ b/lobject.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.h,v 1.144 2002/08/30 19:09:21 roberto Exp roberto $ 2** $Id: lobject.h,v 1.145 2002/09/02 19:54:49 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*/
@@ -316,8 +316,7 @@ extern const TObject luaO_nilobject;
316int luaO_log2 (unsigned int x); 316int luaO_log2 (unsigned int x);
317 317
318 318
319#define luaO_openspace(L,n,t) cast(t *, luaO_openspaceaux(L,(n)*sizeof(t))) 319char *luaO_openspace (lua_State *L, size_t n);
320void *luaO_openspaceaux (lua_State *L, size_t n);
321 320
322int luaO_rawequalObj (const TObject *t1, const TObject *t2); 321int luaO_rawequalObj (const TObject *t1, const TObject *t2);
323int luaO_str2d (const char *s, lua_Number *result); 322int luaO_str2d (const char *s, lua_Number *result);
diff --git a/lstate.h b/lstate.h
index 5f592a9e..618685c1 100644
--- a/lstate.h
+++ b/lstate.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.h,v 1.94 2002/08/12 17:23:12 roberto Exp roberto $ 2** $Id: lstate.h,v 1.95 2002/08/30 19:09:21 roberto Exp roberto $
3** Global State 3** Global State
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -124,7 +124,7 @@ typedef struct global_State {
124 GCObject *rootgc; /* list of (almost) all collectable objects */ 124 GCObject *rootgc; /* list of (almost) all collectable objects */
125 GCObject *rootudata; /* (separated) list of all userdata */ 125 GCObject *rootudata; /* (separated) list of all userdata */
126 GCObject *tmudata; /* list of userdata to be GC */ 126 GCObject *tmudata; /* list of userdata to be GC */
127 void *Mbuffer; /* global buffer */ 127 char *Mbuffer; /* global buffer */
128 size_t Mbuffsize; /* size of Mbuffer */ 128 size_t Mbuffsize; /* size of Mbuffer */
129 lu_mem GCthreshold; 129 lu_mem GCthreshold;
130 lu_mem nblocks; /* number of `bytes' currently allocated */ 130 lu_mem nblocks; /* number of `bytes' currently allocated */
diff --git a/lundump.c b/lundump.c
index 425c31ac..6f2fa287 100644
--- a/lundump.c
+++ b/lundump.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lundump.c,v 1.43 2002/08/07 00:36:03 lhf Exp $ 2** $Id: lundump.c,v 1.52 2002/08/12 13:37:19 roberto Exp roberto $
3** load pre-compiled Lua chunks 3** load pre-compiled Lua chunks
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -99,7 +99,7 @@ static TString* LoadString (LoadState* S)
99 return NULL; 99 return NULL;
100 else 100 else
101 { 101 {
102 char* s=luaO_openspace(S->L,size,char); 102 char* s=luaO_openspace(S->L,size);
103 ezread(S,s,size); 103 ezread(S,s,size);
104 return luaS_newlstr(S->L,s,size-1); /* remove trailing '\0' */ 104 return luaS_newlstr(S->L,s,size-1); /* remove trailing '\0' */
105 } 105 }
diff --git a/lvm.c b/lvm.c
index 4487802e..7f9c08f3 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lvm.c,v 1.253 2002/08/20 20:03:05 roberto Exp roberto $ 2** $Id: lvm.c,v 1.254 2002/08/21 18:56:19 roberto Exp roberto $
3** Lua virtual machine 3** Lua virtual machine
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -303,7 +303,7 @@ void luaV_concat (lua_State *L, int total, int last) {
303 n++; 303 n++;
304 } 304 }
305 if (tl > MAX_SIZET) luaG_runerror(L, "string size overflow"); 305 if (tl > MAX_SIZET) luaG_runerror(L, "string size overflow");
306 buffer = luaO_openspace(L, tl, char); 306 buffer = luaO_openspace(L, tl);
307 tl = 0; 307 tl = 0;
308 for (i=n; i>0; i--) { /* concat all strings */ 308 for (i=n; i>0; i--) { /* concat all strings */
309 size_t l = tsvalue(top-i)->tsv.len; 309 size_t l = tsvalue(top-i)->tsv.len;