summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLua Team <team@lua.org>2011-11-30 12:00:00 +0000
committerrepogen <>2011-11-30 12:00:00 +0000
commitac1beaea25f1fec341e1edb168c63ac7131a6bdd (patch)
tree07b408b92516a459a685fdc1aca30694663051f3 /src
parentdfa489618335f21b74e1b2040a64b28dcbe048a6 (diff)
downloadlua-github-5.2.0-rc3.tar.gz
Lua 5.2.0-rc35.2.0-rc3
Diffstat (limited to 'src')
-rw-r--r--src/lapi.c6
-rw-r--r--src/lauxlib.c37
-rw-r--r--src/lauxlib.h8
-rw-r--r--src/lbaselib.c35
-rw-r--r--src/ldo.c29
-rw-r--r--src/ldo.h5
-rw-r--r--src/lgc.c18
-rw-r--r--src/llimits.h4
-rw-r--r--src/loadlib.c4
-rw-r--r--src/loslib.c28
-rw-r--r--src/ltable.c6
-rw-r--r--src/ltablib.c5
-rw-r--r--src/lua.h5
-rw-r--r--src/luac.c4
-rw-r--r--src/luaconf.h3
-rw-r--r--src/lvm.c9
16 files changed, 103 insertions, 103 deletions
diff --git a/src/lapi.c b/src/lapi.c
index 5437fb0c..977122ea 100644
--- a/src/lapi.c
+++ b/src/lapi.c
@@ -1,5 +1,5 @@
/*
-** $Id: lapi.c,v 2.157 2011/11/16 18:51:36 roberto Exp $
+** $Id: lapi.c,v 2.158 2011/11/29 15:55:08 roberto Exp $
** Lua API
** See Copyright Notice in lua.h
*/
@@ -968,13 +968,13 @@ LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc,
LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data,
- const char *chunkname) {
+ const char *chunkname, const char *mode) {
ZIO z;
int status;
lua_lock(L);
if (!chunkname) chunkname = "?";
luaZ_init(L, &z, reader, data);
- status = luaD_protectedparser(L, &z, chunkname);
+ status = luaD_protectedparser(L, &z, chunkname, mode);
if (status == LUA_OK) { /* no errors? */
LClosure *f = clLvalue(L->top - 1); /* get newly created function */
if (f->nupvalues == 1) { /* does it have one upvalue? */
diff --git a/src/lauxlib.c b/src/lauxlib.c
index d61a8ef8..15730b69 100644
--- a/src/lauxlib.c
+++ b/src/lauxlib.c
@@ -1,5 +1,5 @@
/*
-** $Id: lauxlib.c,v 1.236 2011/11/14 17:10:24 roberto Exp $
+** $Id: lauxlib.c,v 1.237 2011/11/29 15:55:08 roberto Exp $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
@@ -592,16 +592,6 @@ static int errfile (lua_State *L, const char *what, int fnameindex) {
}
-static int checkmode (lua_State *L, const char *mode, const char *x) {
- if (mode && strchr(mode, x[0]) == NULL) {
- lua_pushfstring(L,
- "attempt to load a %s chunk (mode is " LUA_QS ")", x, mode);
- return LUA_ERRFILE;
- }
- else return LUA_OK;
-}
-
-
static int skipBOM (LoadF *lf) {
const char *p = "\xEF\xBB\xBF"; /* Utf8 BOM mark */
int c;
@@ -651,23 +641,14 @@ LUALIB_API int luaL_loadfilex (lua_State *L, const char *filename,
}
if (skipcomment(&lf, &c)) /* read initial portion */
lf.buff[lf.n++] = '\n'; /* add line to correct line numbers */
- if (c == LUA_SIGNATURE[0]) { /* binary file? */
- if ((status = checkmode(L, mode, "binary")) != LUA_OK)
- goto closefile;
- if (filename) {
- lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */
- if (lf.f == NULL) return errfile(L, "reopen", fnameindex);
- skipcomment(&lf, &c); /* re-read initial portion */
- }
- }
- else { /* text file */
- if ((status = checkmode(L, mode, "text")) != LUA_OK)
- goto closefile;
+ if (c == LUA_SIGNATURE[0] && filename) { /* binary file? */
+ lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */
+ if (lf.f == NULL) return errfile(L, "reopen", fnameindex);
+ skipcomment(&lf, &c); /* re-read initial portion */
}
if (c != EOF)
lf.buff[lf.n++] = c; /* 'c' is the first character of the stream */
- status = lua_load(L, getF, &lf, lua_tostring(L, -1));
- closefile:
+ status = lua_load(L, getF, &lf, lua_tostring(L, -1), mode);
readstatus = ferror(lf.f);
if (filename) fclose(lf.f); /* close file (even in case of errors) */
if (readstatus) {
@@ -695,12 +676,12 @@ static const char *getS (lua_State *L, void *ud, size_t *size) {
}
-LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t size,
- const char *name) {
+LUALIB_API int luaL_loadbufferx (lua_State *L, const char *buff, size_t size,
+ const char *name, const char *mode) {
LoadS ls;
ls.s = buff;
ls.size = size;
- return lua_load(L, getS, &ls, name);
+ return lua_load(L, getS, &ls, name, mode);
}
diff --git a/src/lauxlib.h b/src/lauxlib.h
index 48b1afa0..ac4d15fb 100644
--- a/src/lauxlib.h
+++ b/src/lauxlib.h
@@ -1,5 +1,5 @@
/*
-** $Id: lauxlib.h,v 1.119 2011/11/14 17:10:24 roberto Exp $
+** $Id: lauxlib.h,v 1.120 2011/11/29 15:55:08 roberto Exp $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
@@ -77,8 +77,8 @@ LUALIB_API int (luaL_loadfilex) (lua_State *L, const char *filename,
#define luaL_loadfile(L,f) luaL_loadfilex(L,f,NULL)
-LUALIB_API int (luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz,
- const char *name);
+LUALIB_API int (luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz,
+ const char *name, const char *mode);
LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s);
LUALIB_API lua_State *(luaL_newstate) (void);
@@ -131,6 +131,8 @@ LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname,
#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))
+#define luaL_loadbuffer(L,s,sz,n) luaL_loadbufferx(L,s,sz,n,NULL)
+
/*
** {======================================================
diff --git a/src/lbaselib.c b/src/lbaselib.c
index 472a96c8..5db05e21 100644
--- a/src/lbaselib.c
+++ b/src/lbaselib.c
@@ -1,5 +1,5 @@
/*
-** $Id: lbaselib.c,v 1.270 2011/11/23 17:29:04 roberto Exp $
+** $Id: lbaselib.c,v 1.271 2011/11/29 15:55:08 roberto Exp $
** Basic library
** See Copyright Notice in lua.h
*/
@@ -273,25 +273,6 @@ static int luaB_loadfile (lua_State *L) {
*/
-typedef struct {
- const char *mode;
-} loaddata;
-
-
-/*
-** check whether a chunk (prefix in 's') satisfies given 'mode'
-** ('t' for text, 'b' for binary). Returns error message (also
-** pushed on the stack) in case of errors.
-*/
-static const char *checkrights (lua_State *L, const char *mode, const char *s) {
- const char *x = (*s == LUA_SIGNATURE[0]) ? "binary" : "text";
- if (strchr(mode, x[0]) == NULL)
- return lua_pushfstring(L,
- "attempt to load a %s chunk (mode is " LUA_QS ")", x, mode);
- else return NULL;
-}
-
-
/*
** reserved slot, above all arguments, to hold a copy of the returned
** string to avoid it being collected while parsed. 'load' has four
@@ -308,7 +289,7 @@ static const char *checkrights (lua_State *L, const char *mode, const char *s) {
*/
static const char *generic_reader (lua_State *L, void *ud, size_t *size) {
const char *s;
- loaddata *ld = (loaddata *)ud;
+ (void)(ud); /* not used */
luaL_checkstack(L, 2, "too many nested functions");
lua_pushvalue(L, 1); /* get function */
lua_call(L, 0, 1); /* call it */
@@ -317,11 +298,6 @@ static const char *generic_reader (lua_State *L, void *ud, size_t *size) {
return NULL;
}
else if ((s = lua_tostring(L, -1)) != NULL) {
- if (ld->mode != NULL) { /* first time? */
- s = checkrights(L, ld->mode, s); /* check mode */
- ld->mode = NULL; /* to avoid further checks */
- if (s) luaL_error(L, s);
- }
lua_replace(L, RESERVEDSLOT); /* save string in reserved slot */
return lua_tolstring(L, RESERVEDSLOT, size);
}
@@ -340,16 +316,13 @@ static int luaB_load (lua_State *L) {
const char *mode = luaL_optstring(L, 3, "bt");
if (s != NULL) { /* loading a string? */
const char *chunkname = luaL_optstring(L, 2, s);
- status = (checkrights(L, mode, s) != NULL)
- || luaL_loadbuffer(L, s, l, chunkname);
+ status = luaL_loadbufferx(L, s, l, chunkname, mode);
}
else { /* loading from a reader function */
const char *chunkname = luaL_optstring(L, 2, "=(load)");
- loaddata ld;
- ld.mode = mode;
luaL_checktype(L, 1, LUA_TFUNCTION);
lua_settop(L, RESERVEDSLOT); /* create reserved slot */
- status = lua_load(L, generic_reader, &ld, chunkname);
+ status = lua_load(L, generic_reader, NULL, chunkname, mode);
}
if (status == LUA_OK && top >= 4) { /* is there an 'env' argument */
lua_pushvalue(L, 4); /* environment for loaded function */
diff --git a/src/ldo.c b/src/ldo.c
index 0f8c26ea..26f9a674 100644
--- a/src/ldo.c
+++ b/src/ldo.c
@@ -1,5 +1,5 @@
/*
-** $Id: ldo.c,v 2.101 2011/10/07 20:45:19 roberto Exp $
+** $Id: ldo.c,v 2.102 2011/11/29 15:55:08 roberto Exp $
** Stack and Call structure of Lua
** See Copyright Notice in lua.h
*/
@@ -611,18 +611,34 @@ struct SParser { /* data to `f_parser' */
ZIO *z;
Mbuffer buff; /* dynamic structure used by the scanner */
Dyndata dyd; /* dynamic structures used by the parser */
+ const char *mode;
const char *name;
};
+
+static void checkmode (lua_State *L, const char *mode, const char *x) {
+ if (mode && strchr(mode, x[0]) == NULL) {
+ luaO_pushfstring(L,
+ "attempt to load a %s chunk (mode is " LUA_QS ")", x, mode);
+ luaD_throw(L, LUA_ERRSYNTAX);
+ }
+}
+
+
static void f_parser (lua_State *L, void *ud) {
int i;
Proto *tf;
Closure *cl;
struct SParser *p = cast(struct SParser *, ud);
int c = zgetc(p->z); /* read first character */
- tf = (c == LUA_SIGNATURE[0])
- ? luaU_undump(L, p->z, &p->buff, p->name)
- : luaY_parser(L, p->z, &p->buff, &p->dyd, p->name, c);
+ if (c == LUA_SIGNATURE[0]) {
+ checkmode(L, p->mode, "binary");
+ tf = luaU_undump(L, p->z, &p->buff, p->name);
+ }
+ else {
+ checkmode(L, p->mode, "text");
+ tf = luaY_parser(L, p->z, &p->buff, &p->dyd, p->name, c);
+ }
setptvalue2s(L, L->top, tf);
incr_top(L);
cl = luaF_newLclosure(L, tf);
@@ -632,11 +648,12 @@ static void f_parser (lua_State *L, void *ud) {
}
-int luaD_protectedparser (lua_State *L, ZIO *z, const char *name) {
+int luaD_protectedparser (lua_State *L, ZIO *z, const char *name,
+ const char *mode) {
struct SParser p;
int status;
L->nny++; /* cannot yield during parsing */
- p.z = z; p.name = name;
+ p.z = z; p.name = name; p.mode = mode;
p.dyd.actvar.arr = NULL; p.dyd.actvar.size = 0;
p.dyd.gt.arr = NULL; p.dyd.gt.size = 0;
p.dyd.label.arr = NULL; p.dyd.label.size = 0;
diff --git a/src/ldo.h b/src/ldo.h
index edfe0070..27b837d9 100644
--- a/src/ldo.h
+++ b/src/ldo.h
@@ -1,5 +1,5 @@
/*
-** $Id: ldo.h,v 2.19 2011/10/07 20:45:19 roberto Exp $
+** $Id: ldo.h,v 2.20 2011/11/29 15:55:08 roberto Exp $
** Stack and Call structure of Lua
** See Copyright Notice in lua.h
*/
@@ -26,7 +26,8 @@
/* type of protected functions, to be ran by `runprotected' */
typedef void (*Pfunc) (lua_State *L, void *ud);
-LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name);
+LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name,
+ const char *mode);
LUAI_FUNC void luaD_hook (lua_State *L, int event, int line);
LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults);
LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults,
diff --git a/src/lgc.c b/src/lgc.c
index 37de55ca..ac443eb2 100644
--- a/src/lgc.c
+++ b/src/lgc.c
@@ -1,5 +1,5 @@
/*
-** $Id: lgc.c,v 2.114 2011/10/03 17:54:25 roberto Exp $
+** $Id: lgc.c,v 2.115 2011/11/28 17:25:48 roberto Exp $
** Garbage Collector
** See Copyright Notice in lua.h
*/
@@ -94,6 +94,12 @@ static void reallymarkobject (global_State *g, GCObject *o);
/*
+** one after last element in a hash array
+*/
+#define gnodelast(h) gnode(h, cast(size_t, sizenode(h)))
+
+
+/*
** link table 'h' into list pointed by 'p'
*/
#define linktable(h,p) ((h)->gclist = *(p), *(p) = obj2gco(h))
@@ -342,7 +348,7 @@ static void markroot (global_State *g) {
*/
static void traverseweakvalue (global_State *g, Table *h) {
- Node *n, *limit = gnode(h, sizenode(h));
+ Node *n, *limit = gnodelast(h);
/* if there is array part, assume it may have white values (do not
traverse it just to check) */
int hasclears = (h->sizearray > 0);
@@ -368,7 +374,7 @@ static int traverseephemeron (global_State *g, Table *h) {
int marked = 0; /* true if an object is marked in this traversal */
int hasclears = 0; /* true if table has white keys */
int prop = 0; /* true if table has entry "white-key -> white-value" */
- Node *n, *limit = gnode(h, sizenode(h));
+ Node *n, *limit = gnodelast(h);
int i;
/* traverse array part (numeric keys are 'strong') */
for (i = 0; i < h->sizearray; i++) {
@@ -403,7 +409,7 @@ static int traverseephemeron (global_State *g, Table *h) {
static void traversestrongtable (global_State *g, Table *h) {
- Node *n, *limit = gnode(h, sizenode(h));
+ Node *n, *limit = gnodelast(h);
int i;
for (i = 0; i < h->sizearray; i++) /* traverse array part */
markvalue(g, &h->array[i]);
@@ -596,7 +602,7 @@ static void convergeephemerons (global_State *g) {
static void clearkeys (GCObject *l, GCObject *f) {
for (; l != f; l = gco2t(l)->gclist) {
Table *h = gco2t(l);
- Node *n, *limit = gnode(h, sizenode(h));
+ Node *n, *limit = gnodelast(h);
for (n = gnode(h, 0); n < limit; n++) {
if (!ttisnil(gval(n)) && (iscleared(gkey(n)))) {
setnilvalue(gval(n)); /* remove value ... */
@@ -614,7 +620,7 @@ static void clearkeys (GCObject *l, GCObject *f) {
static void clearvalues (GCObject *l, GCObject *f) {
for (; l != f; l = gco2t(l)->gclist) {
Table *h = gco2t(l);
- Node *n, *limit = gnode(h, sizenode(h));
+ Node *n, *limit = gnodelast(h);
int i;
for (i = 0; i < h->sizearray; i++) {
TValue *o = &h->array[i];
diff --git a/src/llimits.h b/src/llimits.h
index 17293ca0..ec2ca896 100644
--- a/src/llimits.h
+++ b/src/llimits.h
@@ -1,5 +1,5 @@
/*
-** $Id: llimits.h,v 1.93 2011/10/07 20:45:19 roberto Exp $
+** $Id: llimits.h,v 1.94 2011/11/29 15:39:48 roberto Exp $
** Limits, basic types, and some other `installation-dependent' definitions
** See Copyright Notice in lua.h
*/
@@ -228,7 +228,7 @@ union luai_Cast { double l_d; LUA_INT32 l_p[2]; };
#define luai_hashnum(i,n) \
{ volatile union luai_Cast u; u.l_d = (n) + 1.0; /* avoid -0 */ \
- (i) = u.l_p[0] + u.l_p[1]; } /* add double bits for his hash */
+ (i) = u.l_p[0]; (i) += u.l_p[1]; } /* add double bits for his hash */
#define lua_number2int(i,n) lua_number2int32(i, n, int)
#define lua_number2integer(i,n) lua_number2int32(i, n, lua_Integer)
diff --git a/src/loadlib.c b/src/loadlib.c
index 28fda6e5..158fb0e3 100644
--- a/src/loadlib.c
+++ b/src/loadlib.c
@@ -1,5 +1,5 @@
/*
-** $Id: loadlib.c,v 1.105 2011/11/25 12:52:03 roberto Exp $
+** $Id: loadlib.c,v 1.106 2011/11/28 17:27:51 roberto Exp $
** Dynamic library loader for Lua
** See Copyright Notice in lua.h
**
@@ -132,7 +132,7 @@ static void ll_unloadlib (void *lib) {
static void *ll_load (lua_State *L, const char *path, int seeglb) {
- void *lib = dlopen(path, RTLD_NOW | (seeglb ? RTLD_GLOBAL : 0));
+ void *lib = dlopen(path, RTLD_NOW | (seeglb ? RTLD_GLOBAL : RTLD_LOCAL));
if (lib == NULL) lua_pushstring(L, dlerror());
return lib;
}
diff --git a/src/loslib.c b/src/loslib.c
index 585ba781..69d33e3a 100644
--- a/src/loslib.c
+++ b/src/loslib.c
@@ -1,5 +1,5 @@
/*
-** $Id: loslib.c,v 1.35 2011/06/20 16:50:59 roberto Exp $
+** $Id: loslib.c,v 1.37 2011/11/29 17:15:42 roberto Exp $
** Standard Operating System library
** See Copyright Notice in lua.h
*/
@@ -58,6 +58,23 @@
#endif
+/*
+** By default, Lua uses gmtime/localtime, except when POSIX is available,
+** where it uses gmtime_r/localtime_r
+*/
+#if defined(lUA_USE_GMTIME_R)
+
+#define l_gmtime(t,r) gmtime_r(t,r)
+#define l_localtime(t,r) localtime_r(t,r)
+
+#elif !defined(l_gmtime)
+
+#define l_gmtime(t,r) ((void)r, gmtime(t))
+#define l_localtime(t,r) ((void)r, localtime(t))
+
+#endif
+
+
static int os_execute (lua_State *L) {
const char *cmd = luaL_optstring(L, 1, NULL);
@@ -177,13 +194,13 @@ static const char *checkoption (lua_State *L, const char *conv, char *buff) {
static int os_date (lua_State *L) {
const char *s = luaL_optstring(L, 1, "%c");
time_t t = luaL_opt(L, (time_t)luaL_checknumber, 2, time(NULL));
- struct tm *stm;
+ struct tm tmr, *stm;
if (*s == '!') { /* UTC? */
- stm = gmtime(&t);
+ stm = l_gmtime(&t, &tmr);
s++; /* skip `!' */
}
else
- stm = localtime(&t);
+ stm = l_localtime(&t, &tmr);
if (stm == NULL) /* invalid date? */
lua_pushnil(L);
else if (strcmp(s, "*t") == 0) {
@@ -274,7 +291,8 @@ static int os_exit (lua_State *L) {
status = luaL_optint(L, 1, EXIT_SUCCESS);
if (lua_toboolean(L, 2))
lua_close(L);
- exit(status);
+ if (L) exit(status); /* 'if' to avoid warnings for unreachable 'return' */
+ return 0;
}
diff --git a/src/ltable.c b/src/ltable.c
index d96d2558..b4aa26c0 100644
--- a/src/ltable.c
+++ b/src/ltable.c
@@ -1,5 +1,5 @@
/*
-** $Id: ltable.c,v 2.65 2011/09/30 12:45:27 roberto Exp $
+** $Id: ltable.c,v 2.66 2011/11/28 17:25:48 roberto Exp $
** Lua tables (hash)
** See Copyright Notice in lua.h
*/
@@ -322,7 +322,7 @@ void luaH_resize (lua_State *L, Table *t, int nasize, int nhsize) {
}
}
if (!isdummy(nold))
- luaM_freearray(L, nold, twoto(oldhsize)); /* free old array */
+ luaM_freearray(L, nold, cast(size_t, twoto(oldhsize))); /* free old array */
}
@@ -370,7 +370,7 @@ Table *luaH_new (lua_State *L) {
void luaH_free (lua_State *L, Table *t) {
if (!isdummy(t->node))
- luaM_freearray(L, t->node, sizenode(t));
+ luaM_freearray(L, t->node, cast(size_t, sizenode(t)));
luaM_freearray(L, t->array, t->sizearray);
luaM_free(L, t);
}
diff --git a/src/ltablib.c b/src/ltablib.c
index 5c3abc35..a52add03 100644
--- a/src/ltablib.c
+++ b/src/ltablib.c
@@ -1,5 +1,5 @@
/*
-** $Id: ltablib.c,v 1.62 2011/09/30 12:45:45 roberto Exp $
+** $Id: ltablib.c,v 1.63 2011/11/28 17:26:30 roberto Exp $
** Library for Table Manipulation
** See Copyright Notice in lua.h
*/
@@ -129,8 +129,7 @@ static int pack (lua_State *L) {
for (i = n; i >= 2; i--) /* assign other elements */
lua_rawseti(L, 1, i);
}
- lua_pushinteger(L, n);
- return 2; /* return table and number of elements */
+ return 1; /* return table */
}
diff --git a/src/lua.h b/src/lua.h
index 2d94f084..1fafa45e 100644
--- a/src/lua.h
+++ b/src/lua.h
@@ -1,5 +1,5 @@
/*
-** $Id: lua.h,v 1.281 2011/10/24 16:53:05 roberto Exp $
+** $Id: lua.h,v 1.282 2011/11/29 15:55:08 roberto Exp $
** Lua - A Scripting Language
** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
** See Copyright Notice at the end of this file
@@ -254,7 +254,8 @@ LUA_API int (lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc,
#define lua_pcall(L,n,r,f) lua_pcallk(L, (n), (r), (f), 0, NULL)
LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt,
- const char *chunkname);
+ const char *chunkname,
+ const char *mode);
LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data);
diff --git a/src/luac.c b/src/luac.c
index fe91beea..5081836d 100644
--- a/src/luac.c
+++ b/src/luac.c
@@ -1,5 +1,5 @@
/*
-** $Id: luac.c,v 1.68 2011/11/23 17:48:18 lhf Exp $
+** $Id: luac.c,v 1.69 2011/11/29 17:46:33 lhf Exp $
** Lua compiler (saves bytecodes to files; also list bytecodes)
** See Copyright Notice in lua.h
*/
@@ -141,7 +141,7 @@ static const Proto* combine(lua_State* L, int n)
{
Proto* f;
int i=n;
- if (lua_load(L,reader,&i,"=(" PROGNAME ")")!=LUA_OK) fatal(lua_tostring(L,-1));
+ if (lua_load(L,reader,&i,"=(" PROGNAME ")",NULL)!=LUA_OK) fatal(lua_tostring(L,-1));
f=toproto(L,-1);
for (i=0; i<n; i++)
{
diff --git a/src/luaconf.h b/src/luaconf.h
index 5cdb7b7b..5417bc61 100644
--- a/src/luaconf.h
+++ b/src/luaconf.h
@@ -1,5 +1,5 @@
/*
-** $Id: luaconf.h,v 1.167 2011/11/25 12:52:27 roberto Exp $
+** $Id: luaconf.h,v 1.168 2011/11/29 17:15:42 roberto Exp $
** Configuration file for Lua
** See Copyright Notice in lua.h
*/
@@ -70,6 +70,7 @@
#define LUA_USE_ISATTY
#define LUA_USE_POPEN
#define LUA_USE_ULONGJMP
+#define lUA_USE_GMTIME_R
#endif
diff --git a/src/lvm.c b/src/lvm.c
index de340776..2eff0fcd 100644
--- a/src/lvm.c
+++ b/src/lvm.c
@@ -1,5 +1,5 @@
/*
-** $Id: lvm.c,v 2.144 2011/10/07 20:45:19 roberto Exp $
+** $Id: lvm.c,v 2.146 2011/11/29 15:54:38 roberto Exp $
** Lua virtual machine
** See Copyright Notice in lua.h
*/
@@ -515,6 +515,7 @@ void luaV_finishOp (lua_State *L) {
#define vmdispatch(o) switch(o)
#define vmcase(l,b) case l: {b} break;
+#define vmcasenb(l,b) case l: {b} /* nb = no break */
void luaV_execute (lua_State *L) {
CallInfo *ci = L->ci;
@@ -534,7 +535,7 @@ void luaV_execute (lua_State *L) {
(--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) {
Protect(traceexec(L));
}
- /* warning!! several calls may realloc the stack and invalidate `ra' */
+ /* WARNING: several calls may realloc the stack and invalidate `ra' */
ra = RA(i);
lua_assert(base == ci->u.l.base);
lua_assert(base <= L->top && L->top < L->stack + L->stacksize);
@@ -741,7 +742,7 @@ void luaV_execute (lua_State *L) {
goto newframe; /* restart luaV_execute over new Lua function */
}
)
- vmcase(OP_RETURN,
+ vmcasenb(OP_RETURN,
int b = GETARG_B(i);
if (b != 0) L->top = ra+b-1;
if (cl->p->sizep > 0) luaF_close(L, base);
@@ -780,7 +781,7 @@ void luaV_execute (lua_State *L) {
setnvalue(ra, luai_numsub(L, nvalue(ra), nvalue(pstep)));
ci->u.l.savedpc += GETARG_sBx(i);
)
- vmcase(OP_TFORCALL,
+ vmcasenb(OP_TFORCALL,
StkId cb = ra + 3; /* call base */
setobjs2s(L, cb+2, ra+2);
setobjs2s(L, cb+1, ra+1);