aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lapi.c10
-rw-r--r--lauxlib.c3
-rw-r--r--lbaselib.c3
-rw-r--r--lgc.c9
-rw-r--r--lgc.h12
-rw-r--r--lmem.c16
-rw-r--r--lstate.c6
-rw-r--r--lstate.h6
-rw-r--r--lstring.h4
-rw-r--r--luaconf.h9
-rw-r--r--lvm.c4
11 files changed, 40 insertions, 42 deletions
diff --git a/lapi.c b/lapi.c
index b08fa6ad..17868b92 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 2.26 2005/01/14 14:19:42 roberto Exp roberto $ 2** $Id: lapi.c,v 2.27 2005/02/18 12:40:02 roberto Exp roberto $
3** Lua API 3** Lua API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -975,7 +975,7 @@ LUA_API void lua_concat (lua_State *L, int n) {
975 975
976LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) { 976LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) {
977 *ud = G(L)->ud; 977 *ud = G(L)->ud;
978 return G(L)->realloc; 978 return G(L)->frealloc;
979} 979}
980 980
981 981
@@ -993,7 +993,7 @@ LUA_API void *lua_newuserdata (lua_State *L, size_t size) {
993 993
994 994
995 995
996static const char *aux_upvalue (lua_State *L, StkId fi, int n, TValue **val) { 996static const char *aux_upvalue (StkId fi, int n, TValue **val) {
997 Closure *f; 997 Closure *f;
998 if (!ttisfunction(fi)) return NULL; 998 if (!ttisfunction(fi)) return NULL;
999 f = clvalue(fi); 999 f = clvalue(fi);
@@ -1015,7 +1015,7 @@ LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) {
1015 const char *name; 1015 const char *name;
1016 TValue *val; 1016 TValue *val;
1017 lua_lock(L); 1017 lua_lock(L);
1018 name = aux_upvalue(L, index2adr(L, funcindex), n, &val); 1018 name = aux_upvalue(index2adr(L, funcindex), n, &val);
1019 if (name) { 1019 if (name) {
1020 setobj2s(L, L->top, val); 1020 setobj2s(L, L->top, val);
1021 api_incr_top(L); 1021 api_incr_top(L);
@@ -1032,7 +1032,7 @@ LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) {
1032 lua_lock(L); 1032 lua_lock(L);
1033 fi = index2adr(L, funcindex); 1033 fi = index2adr(L, funcindex);
1034 api_checknelems(L, 1); 1034 api_checknelems(L, 1);
1035 name = aux_upvalue(L, fi, n, &val); 1035 name = aux_upvalue(fi, n, &val);
1036 if (name) { 1036 if (name) {
1037 L->top--; 1037 L->top--;
1038 setobj(L, val, L->top); 1038 setobj(L, val, L->top);
diff --git a/lauxlib.c b/lauxlib.c
index 79f939da..cccff91b 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.c,v 1.127 2004/12/20 13:47:29 roberto Exp roberto $ 2** $Id: lauxlib.c,v 1.128 2005/02/10 17:12:02 roberto Exp roberto $
3** Auxiliary functions for building Lua libraries 3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -704,6 +704,7 @@ static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
704 704
705 705
706static int panic (lua_State *L) { 706static int panic (lua_State *L) {
707 (void)L; /* to avoid warnings */
707 fprintf(stderr, "PANIC: unprotected error during Lua-API call\n"); 708 fprintf(stderr, "PANIC: unprotected error during Lua-API call\n");
708 return 0; 709 return 0;
709} 710}
diff --git a/lbaselib.c b/lbaselib.c
index 7acbba4b..908bd71e 100644
--- a/lbaselib.c
+++ b/lbaselib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lbaselib.c,v 1.166 2005/02/14 13:19:44 roberto Exp roberto $ 2** $Id: lbaselib.c,v 1.167 2005/02/18 12:40:02 roberto Exp roberto $
3** Basic library 3** Basic library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -283,6 +283,7 @@ static int luaB_loadfile (lua_State *L) {
283** reserved slot inside the stack. 283** reserved slot inside the stack.
284*/ 284*/
285static const char *generic_reader (lua_State *L, void *ud, size_t *size) { 285static const char *generic_reader (lua_State *L, void *ud, size_t *size) {
286 (void)ud; /* to avoid warnings */
286 luaL_checkstack(L, 2, "too many nested functions"); 287 luaL_checkstack(L, 2, "too many nested functions");
287 lua_pushvalue(L, 1); /* get function */ 288 lua_pushvalue(L, 1); /* get function */
288 lua_call(L, 0, 1); /* call it */ 289 lua_call(L, 0, 1); /* call it */
diff --git a/lgc.c b/lgc.c
index da03498a..5cbaa71a 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 2.25 2005/02/14 13:19:50 roberto Exp roberto $ 2** $Id: lgc.c,v 2.26 2005/02/18 12:40:02 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*/
@@ -36,14 +36,13 @@
36 ((x)->gch.marked = ((x)->gch.marked & maskmarks) | luaC_white(g)) 36 ((x)->gch.marked = ((x)->gch.marked & maskmarks) | luaC_white(g))
37 37
38#define white2gray(x) reset2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT) 38#define white2gray(x) reset2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT)
39#define gray2black(x) setbit((x)->gch.marked, BLACKBIT)
40#define black2gray(x) resetbit((x)->gch.marked, BLACKBIT) 39#define black2gray(x) resetbit((x)->gch.marked, BLACKBIT)
41 40
42#define stringmark(s) reset2bits((s)->tsv.marked, WHITE0BIT, WHITE1BIT) 41#define stringmark(s) reset2bits((s)->tsv.marked, WHITE0BIT, WHITE1BIT)
43 42
44 43
45#define isfinalized(u) testbit((u)->marked, FINALIZEDBIT) 44#define isfinalized(u) testbit((u)->marked, FINALIZEDBIT)
46#define markfinalized(u) setbit((u)->marked, FINALIZEDBIT) 45#define markfinalized(u) l_setbit((u)->marked, FINALIZEDBIT)
47 46
48 47
49#define KEYWEAK bitmask(KEYWEAKBIT) 48#define KEYWEAK bitmask(KEYWEAKBIT)
@@ -665,9 +664,9 @@ void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v) {
665} 664}
666 665
667 666
668void luaC_barrierback (lua_State *L, GCObject *o, GCObject *v) { 667void luaC_barrierback (lua_State *L, GCObject *o) {
669 global_State *g = G(L); 668 global_State *g = G(L);
670 lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o)); 669 lua_assert(isblack(o) && !isdead(g, o));
671 lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); 670 lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause);
672 black2gray(o); /* make table gray (again) */ 671 black2gray(o); /* make table gray (again) */
673 gco2h(o)->gclist = g->grayagain; 672 gco2h(o)->gclist = g->grayagain;
diff --git a/lgc.h b/lgc.h
index c3039ee4..be7aa039 100644
--- a/lgc.h
+++ b/lgc.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.h,v 2.10 2005/01/19 15:54:26 roberto Exp roberto $ 2** $Id: lgc.h,v 2.11 2005/02/10 13:25:02 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*/
@@ -29,7 +29,7 @@
29#define testbits(x,m) ((x) & (m)) 29#define testbits(x,m) ((x) & (m))
30#define bitmask(b) (1<<(b)) 30#define bitmask(b) (1<<(b))
31#define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2)) 31#define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2))
32#define setbit(x,b) setbits(x, bitmask(b)) 32#define l_setbit(x,b) setbits(x, bitmask(b))
33#define resetbit(x,b) resetbits(x, bitmask(b)) 33#define resetbit(x,b) resetbits(x, bitmask(b))
34#define testbit(x,b) testbits(x, bitmask(b)) 34#define testbit(x,b) testbits(x, bitmask(b))
35#define set2bits(x,b1,b2) setbits(x, (bit2mask(b1, b2))) 35#define set2bits(x,b1,b2) setbits(x, (bit2mask(b1, b2)))
@@ -70,7 +70,7 @@
70#define isdead(g,v) ((v)->gch.marked & otherwhite(g) & WHITEBITS) 70#define isdead(g,v) ((v)->gch.marked & otherwhite(g) & WHITEBITS)
71 71
72#define changewhite(x) ((x)->gch.marked ^= WHITEBITS) 72#define changewhite(x) ((x)->gch.marked ^= WHITEBITS)
73#define gray2black(x) setbit((x)->gch.marked, BLACKBIT) 73#define gray2black(x) l_setbit((x)->gch.marked, BLACKBIT)
74 74
75#define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x))) 75#define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x)))
76 76
@@ -85,7 +85,7 @@
85 luaC_barrierf(L,obj2gco(p),gcvalue(v)); } 85 luaC_barrierf(L,obj2gco(p),gcvalue(v)); }
86 86
87#define luaC_barriert(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \ 87#define luaC_barriert(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \
88 luaC_barrierback(L,obj2gco(p),gcvalue(v)); } 88 luaC_barrierback(L,obj2gco(p)); }
89 89
90#define luaC_objbarrier(L,p,o) \ 90#define luaC_objbarrier(L,p,o) \
91 { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \ 91 { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \
@@ -93,7 +93,7 @@
93 93
94#define luaC_objbarriert(L,p,o) \ 94#define luaC_objbarriert(L,p,o) \
95 { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \ 95 { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \
96 luaC_barrierback(L,obj2gco(p),obj2gco(o)); } 96 luaC_barrierback(L,obj2gco(p)); }
97 97
98size_t luaC_separateudata (lua_State *L, int all); 98size_t luaC_separateudata (lua_State *L, int all);
99void luaC_callGCTM (lua_State *L); 99void luaC_callGCTM (lua_State *L);
@@ -103,7 +103,7 @@ void luaC_fullgc (lua_State *L);
103void luaC_link (lua_State *L, GCObject *o, lu_byte tt); 103void luaC_link (lua_State *L, GCObject *o, lu_byte tt);
104void luaC_linkupval (lua_State *L, UpVal *uv); 104void luaC_linkupval (lua_State *L, UpVal *uv);
105void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v); 105void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v);
106void luaC_barrierback (lua_State *L, GCObject *o, GCObject *v); 106void luaC_barrierback (lua_State *L, GCObject *o);
107 107
108 108
109#endif 109#endif
diff --git a/lmem.c b/lmem.c
index d48bc09e..a36076fb 100644
--- a/lmem.c
+++ b/lmem.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lmem.c,v 1.67 2004/12/01 15:46:18 roberto Exp roberto $ 2** $Id: lmem.c,v 1.68 2005/01/14 14:21:16 roberto Exp roberto $
3** Interface to Memory Manager 3** Interface to Memory Manager
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -22,19 +22,19 @@
22 22
23/* 23/*
24** About the realloc function: 24** About the realloc function:
25** void * realloc (void *ud, void *ptr, size_t osize, size_t nsize); 25** void * frealloc (void *ud, void *ptr, size_t osize, size_t nsize);
26** (`osize' is the old size, `nsize' is the new size) 26** (`osize' is the old size, `nsize' is the new size)
27** 27**
28** Lua ensures that (ptr == NULL) iff (osize == 0). 28** Lua ensures that (ptr == NULL) iff (osize == 0).
29** 29**
30** * realloc(ud, NULL, 0, x) creates a new block of size `x' 30** * frealloc(ud, NULL, 0, x) creates a new block of size `x'
31** 31**
32** * realloc(ud, p, x, 0) frees the block `p' 32** * frealloc(ud, p, x, 0) frees the block `p'
33** (in this specific case, realloc must return NULL). 33** (in this specific case, frealloc must return NULL).
34** particularly, realloc(ud, NULL, 0, 0) does nothing 34** particularly, frealloc(ud, NULL, 0, 0) does nothing
35** (which is equivalent to free(NULL) in ANSI C) 35** (which is equivalent to free(NULL) in ANSI C)
36** 36**
37** realloc returns NULL if it cannot create or reallocate the area 37** frealloc returns NULL if it cannot create or reallocate the area
38** (any reallocation to an equal or smaller size cannot fail!) 38** (any reallocation to an equal or smaller size cannot fail!)
39*/ 39*/
40 40
@@ -76,7 +76,7 @@ void *luaM_toobig (lua_State *L) {
76void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) { 76void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) {
77 global_State *g = G(L); 77 global_State *g = G(L);
78 lua_assert((osize == 0) == (block == NULL)); 78 lua_assert((osize == 0) == (block == NULL));
79 block = (*g->realloc)(g->ud, block, osize, nsize); 79 block = (*g->frealloc)(g->ud, block, osize, nsize);
80 if (block == NULL && nsize > 0) 80 if (block == NULL && nsize > 0)
81 luaD_throw(L, LUA_ERRMEM); 81 luaD_throw(L, LUA_ERRMEM);
82 lua_assert((nsize == 0) == (block == NULL)); 82 lua_assert((nsize == 0) == (block == NULL));
diff --git a/lstate.c b/lstate.c
index 48d383f1..7c1042a0 100644
--- a/lstate.c
+++ b/lstate.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.c,v 2.23 2005/01/18 17:18:09 roberto Exp roberto $ 2** $Id: lstate.c,v 2.24 2005/02/10 13:25:02 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*/
@@ -120,7 +120,7 @@ static void close_state (lua_State *L) {
120 luaZ_freebuffer(L, &g->buff); 120 luaZ_freebuffer(L, &g->buff);
121 freestack(L, L); 121 freestack(L, L);
122 lua_assert(g->totalbytes == sizeof(LG)); 122 lua_assert(g->totalbytes == sizeof(LG));
123 (*g->realloc)(g->ud, fromstate(L), state_size(LG), 0); 123 (*g->frealloc)(g->ud, fromstate(L), state_size(LG), 0);
124} 124}
125 125
126 126
@@ -160,7 +160,7 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {
160 L->marked = luaC_white(g); 160 L->marked = luaC_white(g);
161 set2bits(L->marked, FIXEDBIT, SFIXEDBIT); 161 set2bits(L->marked, FIXEDBIT, SFIXEDBIT);
162 preinit_state(L, g); 162 preinit_state(L, g);
163 g->realloc = f; 163 g->frealloc = f;
164 g->ud = ud; 164 g->ud = ud;
165 g->mainthread = L; 165 g->mainthread = L;
166 g->uvhead.u.l.prev = &g->uvhead; 166 g->uvhead.u.l.prev = &g->uvhead;
diff --git a/lstate.h b/lstate.h
index 995733d9..481cd4fc 100644
--- a/lstate.h
+++ b/lstate.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.h,v 2.14 2005/02/11 20:03:35 roberto Exp roberto $ 2** $Id: lstate.h,v 2.15 2005/02/18 12:40:02 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*/
@@ -67,8 +67,8 @@ typedef struct CallInfo {
67*/ 67*/
68typedef struct global_State { 68typedef struct global_State {
69 stringtable strt; /* hash table for strings */ 69 stringtable strt; /* hash table for strings */
70 lua_Alloc realloc; /* function to reallocate memory */ 70 lua_Alloc frealloc; /* function to reallocate memory */
71 void *ud; /* auxiliary data to `realloc' */ 71 void *ud; /* auxiliary data to `frealloc' */
72 lu_byte currentwhite; 72 lu_byte currentwhite;
73 lu_byte gcstate; /* state of garbage collector */ 73 lu_byte gcstate; /* state of garbage collector */
74 GCObject *rootgc; /* list of all collectable objects */ 74 GCObject *rootgc; /* list of all collectable objects */
diff --git a/lstring.h b/lstring.h
index 1d2d752e..78bc7e99 100644
--- a/lstring.h
+++ b/lstring.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstring.h,v 1.40 2004/11/19 15:52:40 roberto Exp roberto $ 2** $Id: lstring.h,v 1.41 2005/02/18 12:40:02 roberto Exp roberto $
3** String table (keep all strings handled by Lua) 3** String table (keep all strings handled by Lua)
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -21,7 +21,7 @@
21#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ 21#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \
22 (sizeof(s)/sizeof(char))-1)) 22 (sizeof(s)/sizeof(char))-1))
23 23
24#define luaS_fix(s) setbit((s)->tsv.marked, FIXEDBIT) 24#define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT)
25 25
26void luaS_resize (lua_State *L, int newsize); 26void luaS_resize (lua_State *L, int newsize);
27Udata *luaS_newudata (lua_State *L, size_t s, Table *e); 27Udata *luaS_newudata (lua_State *L, size_t s, Table *e);
diff --git a/luaconf.h b/luaconf.h
index f7ad9a2b..5aadb26b 100644
--- a/luaconf.h
+++ b/luaconf.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: luaconf.h,v 1.27 2005/01/10 18:33:37 roberto Exp roberto $ 2** $Id: luaconf.h,v 1.28 2005/02/10 17:12:02 roberto Exp roberto $
3** Configuration file for Lua 3** Configuration file for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -307,7 +307,7 @@ __inline int l_lrint (double flt)
307 307
308 308
309/* allows user-specific initialization on new threads */ 309/* allows user-specific initialization on new threads */
310#define lua_userstateopen(L) /* empty */ 310#define lua_userstateopen(L) ((void)0)
311 311
312 312
313#endif 313#endif
@@ -325,9 +325,6 @@ __inline int l_lrint (double flt)
325#ifdef LUA_LIB 325#ifdef LUA_LIB
326 326
327 327
328
329/* `assert' options */
330
331/* environment variables that hold the search path for packages */ 328/* environment variables that hold the search path for packages */
332#define LUA_PATH "LUA_PATH" 329#define LUA_PATH "LUA_PATH"
333#define LUA_CPATH "LUA_CPATH" 330#define LUA_CPATH "LUA_CPATH"
@@ -336,7 +333,7 @@ __inline int l_lrint (double flt)
336#define LUA_POF "luaopen_" 333#define LUA_POF "luaopen_"
337 334
338/* separator for open functions in C libraries */ 335/* separator for open functions in C libraries */
339#define LUA_OFSEP "" 336#define LUA_OFSEP "_"
340 337
341/* directory separator (for submodules) */ 338/* directory separator (for submodules) */
342#if defined(_WIN32) 339#if defined(_WIN32)
diff --git a/lvm.c b/lvm.c
index 04007de6..add95d35 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lvm.c,v 2.24 2005/02/18 12:40:02 roberto Exp roberto $ 2** $Id: lvm.c,v 2.25 2005/02/18 12:50:08 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*/
@@ -113,7 +113,7 @@ StkId luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val,
113 const TValue *tm; 113 const TValue *tm;
114 if (ttistable(t)) { /* `t' is a table? */ 114 if (ttistable(t)) { /* `t' is a table? */
115 Table *h = hvalue(t); 115 Table *h = hvalue(t);
116 const TValue *res = luaH_get(h, key); /* do a primitive set */ 116 const TValue *res = luaH_get(h, key); /* do a primitive get */
117 if (!ttisnil(res) || /* result is no nil? */ 117 if (!ttisnil(res) || /* result is no nil? */
118 (tm = fasttm(L, h->metatable, TM_INDEX)) == NULL) { /* or no TM? */ 118 (tm = fasttm(L, h->metatable, TM_INDEX)) == NULL) { /* or no TM? */
119 setobj2s(L, val, res); 119 setobj2s(L, val, res);