more uniform names for 'equalobj'-related functions

This commit is contained in:
Roberto Ierusalimschy
2011-05-31 15:27:56 -03:00
parent 9b7dddad7d
commit 821bd7025e
5 changed files with 15 additions and 15 deletions

4
lapi.c
View File

@@ -1,5 +1,5 @@
/* /*
** $Id: lapi.c,v 2.145 2011/04/05 14:26:23 roberto Exp roberto $ ** $Id: lapi.c,v 2.146 2011/05/31 18:24:36 roberto Exp roberto $
** Lua API ** Lua API
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -278,7 +278,7 @@ LUA_API int lua_rawequal (lua_State *L, int index1, int index2) {
StkId o1 = index2addr(L, index1); StkId o1 = index2addr(L, index1);
StkId o2 = index2addr(L, index2); StkId o2 = index2addr(L, index2);
return (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 return (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0
: luaV_rawequalObj(o1, o2); : luaV_rawequalobj(o1, o2);
} }

View File

@@ -1,5 +1,5 @@
/* /*
** $Id: lcode.c,v 2.54 2011/04/28 14:00:11 roberto Exp roberto $ ** $Id: lcode.c,v 2.55 2011/05/31 18:24:36 roberto Exp roberto $
** Code generator for Lua ** Code generator for Lua
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -296,7 +296,7 @@ static int addk (FuncState *fs, TValue *key, TValue *v) {
if (ttisnumber(idx)) { if (ttisnumber(idx)) {
lua_Number n = nvalue(idx); lua_Number n = nvalue(idx);
lua_number2int(k, n); lua_number2int(k, n);
if (luaV_rawequalObj(&f->k[k], v)) if (luaV_rawequalobj(&f->k[k], v))
return k; return k;
/* else may be a collision (e.g., between 0.0 and "\0\0\0\0\0\0\0\0"); /* else may be a collision (e.g., between 0.0 and "\0\0\0\0\0\0\0\0");
go through and create a new entry for this value */ go through and create a new entry for this value */

View File

@@ -1,5 +1,5 @@
/* /*
** $Id: ltable.c,v 2.55 2011/05/02 16:45:32 roberto Exp roberto $ ** $Id: ltable.c,v 2.56 2011/05/31 18:24:36 roberto Exp roberto $
** Lua tables (hash) ** Lua tables (hash)
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -149,7 +149,7 @@ static int findindex (lua_State *L, Table *t, StkId key) {
Node *n = mainposition(t, key); Node *n = mainposition(t, key);
do { /* check whether `key' is somewhere in the chain */ do { /* check whether `key' is somewhere in the chain */
/* key may be dead already, but it is ok to use it in `next' */ /* key may be dead already, but it is ok to use it in `next' */
if (luaV_rawequalObj(gkey(n), key) || if (luaV_rawequalobj(gkey(n), key) ||
(ttisdeadkey(gkey(n)) && iscollectable(key) && (ttisdeadkey(gkey(n)) && iscollectable(key) &&
gcvalue(gkey(n)) == gcvalue(key))) { gcvalue(gkey(n)) == gcvalue(key))) {
i = cast_int(n - gnode(t, 0)); /* key index in hash table */ i = cast_int(n - gnode(t, 0)); /* key index in hash table */
@@ -482,7 +482,7 @@ const TValue *luaH_get (Table *t, const TValue *key) {
default: { default: {
Node *n = mainposition(t, key); Node *n = mainposition(t, key);
do { /* check whether `key' is somewhere in the chain */ do { /* check whether `key' is somewhere in the chain */
if (luaV_rawequalObj(gkey(n), key)) if (luaV_rawequalobj(gkey(n), key))
return gval(n); /* that's it */ return gval(n); /* that's it */
else n = gnext(n); else n = gnext(n);
} while (n); } while (n);

6
lvm.c
View File

@@ -1,5 +1,5 @@
/* /*
** $Id: lvm.c,v 2.137 2011/05/05 16:16:33 roberto Exp roberto $ ** $Id: lvm.c,v 2.138 2011/05/31 18:24:36 roberto Exp roberto $
** Lua virtual machine ** Lua virtual machine
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -174,7 +174,7 @@ static const TValue *get_equalTM (lua_State *L, Table *mt1, Table *mt2,
if (mt1 == mt2) return tm1; /* same metatables => same metamethods */ if (mt1 == mt2) return tm1; /* same metatables => same metamethods */
tm2 = fasttm(L, mt2, event); tm2 = fasttm(L, mt2, event);
if (tm2 == NULL) return NULL; /* no metamethod */ if (tm2 == NULL) return NULL; /* no metamethod */
if (luaV_rawequalObj(tm1, tm2)) /* same metamethods? */ if (luaV_rawequalobj(tm1, tm2)) /* same metamethods? */
return tm1; return tm1;
return NULL; return NULL;
} }
@@ -240,7 +240,7 @@ int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r) {
/* /*
** equality of Lua values. L == NULL means raw equality (no metamethods) ** equality of Lua values. L == NULL means raw equality (no metamethods)
*/ */
int luaV_equalval_ (lua_State *L, const TValue *t1, const TValue *t2) { int luaV_equalobj_ (lua_State *L, const TValue *t1, const TValue *t2) {
const TValue *tm; const TValue *tm;
lua_assert(ttisequal(t1, t2)); lua_assert(ttisequal(t1, t2));
switch (ttype(t1)) { switch (ttype(t1)) {

10
lvm.h
View File

@@ -1,5 +1,5 @@
/* /*
** $Id: lvm.h,v 2.15 2011/04/05 18:32:06 roberto Exp roberto $ ** $Id: lvm.h,v 2.16 2011/05/31 18:24:36 roberto Exp roberto $
** Lua virtual machine ** Lua virtual machine
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -17,14 +17,14 @@
#define tonumber(o,n) (ttisnumber(o) || (((o) = luaV_tonumber(o,n)) != NULL)) #define tonumber(o,n) (ttisnumber(o) || (((o) = luaV_tonumber(o,n)) != NULL))
#define equalobj(L,o1,o2) (ttisequal(o1, o2) && luaV_equalval_(L, o1, o2)) #define equalobj(L,o1,o2) (ttisequal(o1, o2) && luaV_equalobj_(L, o1, o2))
#define luaV_rawequalObj(t1,t2) \ #define luaV_rawequalobj(t1,t2) \
(ttisequal(t1,t2) && luaV_equalval_(NULL,t1,t2)) (ttisequal(t1,t2) && luaV_equalobj_(NULL,t1,t2))
/* not to called directly */ /* not to called directly */
LUAI_FUNC int luaV_equalval_ (lua_State *L, const TValue *t1, const TValue *t2); LUAI_FUNC int luaV_equalobj_ (lua_State *L, const TValue *t1, const TValue *t2);
LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r);