Resolve conflicts.

This commit is contained in:
mbalmer 2015-10-08 12:40:05 +00:00
parent 21f9e8b0ed
commit b2829499b0
3 changed files with 23 additions and 4 deletions

View File

@ -46,7 +46,7 @@ TO_MAN= lua.1 luac.1
# Lua version and release.
V= 5.3
R= $V.0
R= $V.1
# Targets start here.
all: $(PLAT)

View File

@ -1,5 +1,5 @@
This is Lua 5.3.0, released on 06 Jan 2015.
This is Lua 5.3.1, released on 10 Jun 2015.
For installation instructions, license details, and
further information about Lua, see doc/readme.html.

View File

@ -1,7 +1,7 @@
/* $NetBSD: ldblib.c,v 1.5 2015/02/02 14:03:05 lneto Exp $ */
/* $NetBSD: ldblib.c,v 1.6 2015/10/08 12:40:05 mbalmer Exp $ */
/*
** Id: ldblib.c,v 1.148 2015/01/02 12:52:22 roberto Exp
** Id: ldblib.c,v 1.149 2015/02/19 17:06:21 roberto Exp
** Interface from Lua to its debug API
** See Copyright Notice in lua.h
*/
@ -31,6 +31,17 @@
static const int HOOKKEY = 0;
/*
** If L1 != L, L1 can be in any state, and therefore there is no
** garanties about its stack space; any push in L1 must be
** checked.
*/
static void checkstack (lua_State *L, lua_State *L1, int n) {
if (L != L1 && !lua_checkstack(L1, n))
luaL_error(L, "stack overflow");
}
static int db_getregistry (lua_State *L) {
lua_pushvalue(L, LUA_REGISTRYINDEX);
return 1;
@ -131,12 +142,16 @@ static void treatstackoption (lua_State *L, lua_State *L1, const char *fname) {
/*
** Calls 'lua_getinfo' and collects all results in a new table.
** L1 needs stack space for an optional input (function) plus
** two optional outputs (function and line table) from function
** 'lua_getinfo'.
*/
static int db_getinfo (lua_State *L) {
lua_Debug ar;
int arg;
lua_State *L1 = getthread(L, &arg);
const char *options = luaL_optstring(L, arg+2, "flnStu");
checkstack(L, L1, 3);
if (lua_isfunction(L, arg + 1)) { /* info about a function? */
options = lua_pushfstring(L, ">%s", options); /* add '>' to 'options' */
lua_pushvalue(L, arg + 1); /* move function to 'L1' stack */
@ -194,6 +209,7 @@ static int db_getlocal (lua_State *L) {
int level = (int)luaL_checkinteger(L, arg + 1);
if (!lua_getstack(L1, level, &ar)) /* out of range? */
return luaL_argerror(L, arg+1, "level out of range");
checkstack(L, L1, 1);
name = lua_getlocal(L1, &ar, nvar);
if (name) {
lua_xmove(L1, L, 1); /* move local value */
@ -220,6 +236,7 @@ static int db_setlocal (lua_State *L) {
return luaL_argerror(L, arg+1, "level out of range");
luaL_checkany(L, arg+3);
lua_settop(L, arg+3);
checkstack(L, L1, 1);
lua_xmove(L, L1, 1);
name = lua_setlocal(L1, &ar, nvar);
if (name == NULL)
@ -354,6 +371,7 @@ static int db_sethook (lua_State *L) {
lua_pushvalue(L, -1);
lua_setmetatable(L, -2); /* setmetatable(hooktable) = hooktable */
}
checkstack(L, L1, 1);
lua_pushthread(L1); lua_xmove(L1, L, 1); /* key (thread) */
lua_pushvalue(L, arg + 1); /* value (hook function) */
lua_rawset(L, -3); /* hooktable[L1] = new Lua hook */
@ -374,6 +392,7 @@ static int db_gethook (lua_State *L) {
lua_pushliteral(L, "external hook");
else { /* hook table must exist */
lua_rawgetp(L, LUA_REGISTRYINDEX, &HOOKKEY);
checkstack(L, L1, 1);
lua_pushthread(L1); lua_xmove(L1, L, 1);
lua_rawget(L, -2); /* 1st result = hooktable[L1] */
lua_remove(L, -2); /* remove hook table */