From 528665089402ea1fff2c36efb4c95c416f01c962 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 5 Apr 2011 15:32:06 -0300 Subject: [PATCH] new macro 'ttisequal' --- lobject.c | 4 ++-- lvm.c | 4 ++-- lvm.h | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lobject.c b/lobject.c index be00daf0..0fd44626 100644 --- a/lobject.c +++ b/lobject.c @@ -1,5 +1,5 @@ /* -** $Id: lobject.c,v 2.45 2010/12/10 19:03:46 roberto Exp roberto $ +** $Id: lobject.c,v 2.46 2011/02/07 19:15:24 roberto Exp roberto $ ** Some generic functions over Lua objects ** See Copyright Notice in lua.h */ @@ -71,7 +71,7 @@ int luaO_ceillog2 (unsigned int x) { int luaO_rawequalObj (const TValue *t1, const TValue *t2) { - if (ttype(t1) != ttype(t2)) return 0; + if (!ttisequal(t1, t2)) return 0; else switch (ttype(t1)) { case LUA_TNIL: return 1; diff --git a/lvm.c b/lvm.c index e245618c..03725eb7 100644 --- a/lvm.c +++ b/lvm.c @@ -1,5 +1,5 @@ /* -** $Id: lvm.c,v 2.131 2011/02/07 19:15:24 roberto Exp roberto $ +** $Id: lvm.c,v 2.132 2011/04/05 14:26:23 roberto Exp roberto $ ** Lua virtual machine ** See Copyright Notice in lua.h */ @@ -239,7 +239,7 @@ int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r) { int luaV_equalval_ (lua_State *L, const TValue *t1, const TValue *t2) { const TValue *tm; - lua_assert(ttype(t1) == ttype(t2)); + lua_assert(ttisequal(t1, t2)); switch (ttype(t1)) { case LUA_TNIL: return 1; case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2)); diff --git a/lvm.h b/lvm.h index 23e50798..8e61cf34 100644 --- a/lvm.h +++ b/lvm.h @@ -1,5 +1,5 @@ /* -** $Id: lvm.h,v 2.13 2009/11/19 19:04:58 roberto Exp roberto $ +** $Id: lvm.h,v 2.14 2009/12/17 16:20:01 roberto Exp roberto $ ** Lua virtual machine ** See Copyright Notice in lua.h */ @@ -17,8 +17,7 @@ #define tonumber(o,n) (ttisnumber(o) || (((o) = luaV_tonumber(o,n)) != NULL)) -#define equalobj(L,o1,o2) \ - (ttype(o1) == ttype(o2) && luaV_equalval_(L, o1, o2)) +#define equalobj(L,o1,o2) (ttisequal(o1, o2) && luaV_equalval_(L, o1, o2)) /* not to called directly */