lua

A copy of the Lua development repository
Log | Files | Refs | README

commit f88806a1fbf333b9495ffb9049c67ba27a3a6d49
parent fb6eee2805c02356ffbeac8da8a2b9263af260fe
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Mon, 23 Jan 2012 21:01:46 -0200

"default: lua_assert(0)" in switches helps debugging + uses
non-variant types in binary files

Diffstat:
Mldump.c | 7++++---
Mlundump.c | 3++-
2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/ldump.c b/ldump.c @@ -1,5 +1,5 @@ /* -** $Id: ldump.c,v 1.19 2011/11/23 17:48:18 lhf Exp $ +** $Id: ldump.c,v 2.16 2011/11/24 13:25:41 roberto Exp roberto $ ** save precompiled Lua chunks ** See Copyright Notice in lua.h */ @@ -84,8 +84,8 @@ static void DumpConstants(const Proto* f, DumpState* D) for (i=0; i<n; i++) { const TValue* o=&f->k[i]; - DumpChar(ttype(o),D); - switch (ttype(o)) + DumpChar(ttypenv(o),D); + switch (ttypenv(o)) { case LUA_TNIL: break; @@ -98,6 +98,7 @@ static void DumpConstants(const Proto* f, DumpState* D) case LUA_TSTRING: DumpString(rawtsvalue(o),D); break; + default: lua_assert(0); } } n=f->sizep; diff --git a/lundump.c b/lundump.c @@ -1,5 +1,5 @@ /* -** $Id: lundump.c,v 1.71 2011/12/07 10:39:12 lhf Exp lhf $ +** $Id: lundump.c,v 2.19 2011/12/07 18:03:47 roberto Exp roberto $ ** load precompiled Lua chunks ** See Copyright Notice in lua.h */ @@ -118,6 +118,7 @@ static void LoadConstants(LoadState* S, Proto* f) case LUA_TSTRING: setsvalue2n(S->L,o,LoadString(S)); break; + default: lua_assert(0); } } n=LoadInt(S);