mirror of https://github.com/rusefi/lua.git
state's buffer is used only for chars
This commit is contained in:
parent
f6bc7884be
commit
565e6d74e1
4
llex.c
4
llex.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: llex.c,v 1.110 2002/09/03 11:57:38 roberto Exp roberto $
|
||||
** $Id: llex.c,v 1.111 2002/09/05 19:45:42 roberto Exp roberto $
|
||||
** Lexical Analyzer
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -141,7 +141,7 @@ void luaX_setinput (lua_State *L, LexState *LS, ZIO *z, TString *source) {
|
|||
#define EXTRABUFF 128
|
||||
#define checkbuffer(L, len) \
|
||||
if (((len)+10)*sizeof(char) > G(L)->Mbuffsize) \
|
||||
luaO_openspace(L, (len)+EXTRABUFF, char)
|
||||
luaO_openspace(L, (len)+EXTRABUFF)
|
||||
|
||||
#define save(L, c, l) (cast(char *, G(L)->Mbuffer)[l++] = cast(char, c))
|
||||
#define save_and_next(L, LS, l) (save(L, LS->current, l), next(LS))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lobject.c,v 1.86 2002/08/07 14:35:55 roberto Exp roberto $
|
||||
** $Id: lobject.c,v 1.87 2002/09/02 19:54:49 roberto Exp roberto $
|
||||
** Some generic functions over Lua objects
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -72,9 +72,9 @@ int luaO_rawequalObj (const TObject *t1, const TObject *t2) {
|
|||
}
|
||||
|
||||
|
||||
void *luaO_openspaceaux (lua_State *L, size_t n) {
|
||||
char *luaO_openspace (lua_State *L, size_t n) {
|
||||
if (n > G(L)->Mbuffsize) {
|
||||
G(L)->Mbuffer = luaM_realloc(L, G(L)->Mbuffer, G(L)->Mbuffsize, n);
|
||||
luaM_reallocvector(L, G(L)->Mbuffer, G(L)->Mbuffsize, n, char);
|
||||
G(L)->Mbuffsize = n;
|
||||
}
|
||||
return G(L)->Mbuffer;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lobject.h,v 1.144 2002/08/30 19:09:21 roberto Exp roberto $
|
||||
** $Id: lobject.h,v 1.145 2002/09/02 19:54:49 roberto Exp roberto $
|
||||
** Type definitions for Lua objects
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -316,8 +316,7 @@ extern const TObject luaO_nilobject;
|
|||
int luaO_log2 (unsigned int x);
|
||||
|
||||
|
||||
#define luaO_openspace(L,n,t) cast(t *, luaO_openspaceaux(L,(n)*sizeof(t)))
|
||||
void *luaO_openspaceaux (lua_State *L, size_t n);
|
||||
char *luaO_openspace (lua_State *L, size_t n);
|
||||
|
||||
int luaO_rawequalObj (const TObject *t1, const TObject *t2);
|
||||
int luaO_str2d (const char *s, lua_Number *result);
|
||||
|
|
4
lstate.h
4
lstate.h
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lstate.h,v 1.94 2002/08/12 17:23:12 roberto Exp roberto $
|
||||
** $Id: lstate.h,v 1.95 2002/08/30 19:09:21 roberto Exp roberto $
|
||||
** Global State
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -124,7 +124,7 @@ typedef struct global_State {
|
|||
GCObject *rootgc; /* list of (almost) all collectable objects */
|
||||
GCObject *rootudata; /* (separated) list of all userdata */
|
||||
GCObject *tmudata; /* list of userdata to be GC */
|
||||
void *Mbuffer; /* global buffer */
|
||||
char *Mbuffer; /* global buffer */
|
||||
size_t Mbuffsize; /* size of Mbuffer */
|
||||
lu_mem GCthreshold;
|
||||
lu_mem nblocks; /* number of `bytes' currently allocated */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lundump.c,v 1.43 2002/08/07 00:36:03 lhf Exp $
|
||||
** $Id: lundump.c,v 1.52 2002/08/12 13:37:19 roberto Exp roberto $
|
||||
** load pre-compiled Lua chunks
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -99,7 +99,7 @@ static TString* LoadString (LoadState* S)
|
|||
return NULL;
|
||||
else
|
||||
{
|
||||
char* s=luaO_openspace(S->L,size,char);
|
||||
char* s=luaO_openspace(S->L,size);
|
||||
ezread(S,s,size);
|
||||
return luaS_newlstr(S->L,s,size-1); /* remove trailing '\0' */
|
||||
}
|
||||
|
|
4
lvm.c
4
lvm.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lvm.c,v 1.253 2002/08/20 20:03:05 roberto Exp roberto $
|
||||
** $Id: lvm.c,v 1.254 2002/08/21 18:56:19 roberto Exp roberto $
|
||||
** Lua virtual machine
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -303,7 +303,7 @@ void luaV_concat (lua_State *L, int total, int last) {
|
|||
n++;
|
||||
}
|
||||
if (tl > MAX_SIZET) luaG_runerror(L, "string size overflow");
|
||||
buffer = luaO_openspace(L, tl, char);
|
||||
buffer = luaO_openspace(L, tl);
|
||||
tl = 0;
|
||||
for (i=n; i>0; i--) { /* concat all strings */
|
||||
size_t l = tsvalue(top-i)->tsv.len;
|
||||
|
|
Loading…
Reference in New Issue