mirror of https://github.com/lua/lua
more uniform names for 'equalobj'-related functions
This commit is contained in:
parent
9b7dddad7d
commit
821bd7025e
4
lapi.c
4
lapi.c
|
@ -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
|
||||
** 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 o2 = index2addr(L, index2);
|
||||
return (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0
|
||||
: luaV_rawequalObj(o1, o2);
|
||||
: luaV_rawequalobj(o1, o2);
|
||||
}
|
||||
|
||||
|
||||
|
|
4
lcode.c
4
lcode.c
|
@ -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
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -296,7 +296,7 @@ static int addk (FuncState *fs, TValue *key, TValue *v) {
|
|||
if (ttisnumber(idx)) {
|
||||
lua_Number n = nvalue(idx);
|
||||
lua_number2int(k, n);
|
||||
if (luaV_rawequalObj(&f->k[k], v))
|
||||
if (luaV_rawequalobj(&f->k[k], v))
|
||||
return k;
|
||||
/* 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 */
|
||||
|
|
6
ltable.c
6
ltable.c
|
@ -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)
|
||||
** 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);
|
||||
do { /* check whether `key' is somewhere in the chain */
|
||||
/* 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) &&
|
||||
gcvalue(gkey(n)) == gcvalue(key))) {
|
||||
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: {
|
||||
Node *n = mainposition(t, key);
|
||||
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 */
|
||||
else n = gnext(n);
|
||||
} while (n);
|
||||
|
|
6
lvm.c
6
lvm.c
|
@ -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
|
||||
** 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 */
|
||||
tm2 = fasttm(L, mt2, event);
|
||||
if (tm2 == NULL) return NULL; /* no metamethod */
|
||||
if (luaV_rawequalObj(tm1, tm2)) /* same metamethods? */
|
||||
if (luaV_rawequalobj(tm1, tm2)) /* same metamethods? */
|
||||
return tm1;
|
||||
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)
|
||||
*/
|
||||
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;
|
||||
lua_assert(ttisequal(t1, t2));
|
||||
switch (ttype(t1)) {
|
||||
|
|
10
lvm.h
10
lvm.h
|
@ -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
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -17,14 +17,14 @@
|
|||
|
||||
#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) \
|
||||
(ttisequal(t1,t2) && luaV_equalval_(NULL,t1,t2))
|
||||
#define luaV_rawequalobj(t1,t2) \
|
||||
(ttisequal(t1,t2) && luaV_equalobj_(NULL,t1,t2))
|
||||
|
||||
|
||||
/* 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);
|
||||
|
|
Loading…
Reference in New Issue