keep memory-error message in the global state, so that its use

does not depend on Lua internalizing strings to avoid a string
creation on memory errors
This commit is contained in:
Roberto Ierusalimschy
2010-04-08 14:16:46 -03:00
parent 28aa733c15
commit 055104f5b6
4 changed files with 13 additions and 9 deletions

6
ldo.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: ldo.c,v 2.81 2010/02/09 11:56:29 roberto Exp roberto $
** $Id: ldo.c,v 2.82 2010/03/26 20:58:11 roberto Exp roberto $
** Stack and Call structure of Lua
** See Copyright Notice in lua.h
*/
@@ -83,8 +83,8 @@ struct lua_longjmp {
static void seterrorobj (lua_State *L, int errcode, StkId oldtop) {
switch (errcode) {
case LUA_ERRMEM: {
setsvalue2s(L, oldtop, luaS_newliteral(L, MEMERRMSG));
case LUA_ERRMEM: { /* memory error? */
setsvalue2s(L, oldtop, G(L)->memerrmsg); /* reuse preregistered msg. */
break;
}
case LUA_ERRERR: {