commit 528665089402ea1fff2c36efb4c95c416f01c962
parent 0fb1644c6070daada206fc091f45b4bc39381ea2
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Tue, 5 Apr 2011 15:31:42 -0300
new macro 'ttisequal'
Diffstat:
3 files changed, 6 insertions(+), 7 deletions(-)
diff --git 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
@@ -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
@@ -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 */