瀏覽代碼

'eqstr' -> 'luaS_eqstr'

Roberto Ierusalimschy 13 年之前
父節點
當前提交
9f1a8dbdd3
共有 3 個文件被更改,包括 13 次插入13 次删除
  1. 8 8
      lparser.c
  2. 2 2
      ltable.c
  3. 3 3
      lvm.c

+ 8 - 8
lparser.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lparser.c,v 2.123 2011/11/30 12:43:51 roberto Exp roberto $
+** $Id: lparser.c,v 2.124 2011/12/02 13:23:56 roberto Exp roberto $
 ** Lua Parser
 ** Lua Parser
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -222,7 +222,7 @@ static int searchupvalue (FuncState *fs, TString *name) {
   int i;
   int i;
   Upvaldesc *up = fs->f->upvalues;
   Upvaldesc *up = fs->f->upvalues;
   for (i = 0; i < fs->nups; i++) {
   for (i = 0; i < fs->nups; i++) {
-    if (eqstr(up[i].name, name)) return i;
+    if (luaS_eqstr(up[i].name, name)) return i;
   }
   }
   return -1;  /* not found */
   return -1;  /* not found */
 }
 }
@@ -246,7 +246,7 @@ static int newupvalue (FuncState *fs, TString *name, expdesc *v) {
 static int searchvar (FuncState *fs, TString *n) {
 static int searchvar (FuncState *fs, TString *n) {
   int i;
   int i;
   for (i=fs->nactvar-1; i >= 0; i--) {
   for (i=fs->nactvar-1; i >= 0; i--) {
-    if (eqstr(n, getlocvar(fs, i)->varname))
+    if (luaS_eqstr(n, getlocvar(fs, i)->varname))
       return i;
       return i;
   }
   }
   return -1;  /* not found */
   return -1;  /* not found */
@@ -342,7 +342,7 @@ static void closegoto (LexState *ls, int g, Labeldesc *label) {
   FuncState *fs = ls->fs;
   FuncState *fs = ls->fs;
   Labellist *gl = &ls->dyd->gt;
   Labellist *gl = &ls->dyd->gt;
   Labeldesc *gt = &gl->arr[g];
   Labeldesc *gt = &gl->arr[g];
-  lua_assert(eqstr(gt->name, label->name));
+  lua_assert(luaS_eqstr(gt->name, label->name));
   if (gt->nactvar < label->nactvar) {
   if (gt->nactvar < label->nactvar) {
     TString *vname = getlocvar(fs, gt->nactvar)->varname;
     TString *vname = getlocvar(fs, gt->nactvar)->varname;
     const char *msg = luaO_pushfstring(ls->L,
     const char *msg = luaO_pushfstring(ls->L,
@@ -369,7 +369,7 @@ static int findlabel (LexState *ls, int g) {
   /* check labels in current block for a match */
   /* check labels in current block for a match */
   for (i = bl->firstlabel; i < dyd->label.n; i++) {
   for (i = bl->firstlabel; i < dyd->label.n; i++) {
     Labeldesc *lb = &dyd->label.arr[i];
     Labeldesc *lb = &dyd->label.arr[i];
-    if (eqstr(lb->name, gt->name)) {  /* correct label? */
+    if (luaS_eqstr(lb->name, gt->name)) {  /* correct label? */
       if (gt->nactvar > lb->nactvar &&
       if (gt->nactvar > lb->nactvar &&
           (bl->upval || dyd->label.n > bl->firstlabel))
           (bl->upval || dyd->label.n > bl->firstlabel))
         luaK_patchclose(ls->fs, gt->pc, lb->nactvar);
         luaK_patchclose(ls->fs, gt->pc, lb->nactvar);
@@ -403,7 +403,7 @@ static void findgotos (LexState *ls, Labeldesc *lb) {
   Labellist *gl = &ls->dyd->gt;
   Labellist *gl = &ls->dyd->gt;
   int i = ls->fs->bl->firstgoto;
   int i = ls->fs->bl->firstgoto;
   while (i < gl->n) {
   while (i < gl->n) {
-    if (eqstr(gl->arr[i].name, lb->name))
+    if (luaS_eqstr(gl->arr[i].name, lb->name))
       closegoto(ls, i, lb);
       closegoto(ls, i, lb);
     else
     else
       i++;
       i++;
@@ -461,7 +461,7 @@ static void breaklabel (LexState *ls) {
 ** message when label name is a reserved word (which can only be 'break')
 ** message when label name is a reserved word (which can only be 'break')
 */
 */
 static l_noret undefgoto (LexState *ls, Labeldesc *gt) {
 static l_noret undefgoto (LexState *ls, Labeldesc *gt) {
-  const char *msg = (gt->name->tsv.reserved > 0)
+  const char *msg = isreserved(gt->name)
                     ? "<%s> at line %d not inside a loop"
                     ? "<%s> at line %d not inside a loop"
                     : "no visible label " LUA_QS " for <goto> at line %d";
                     : "no visible label " LUA_QS " for <goto> at line %d";
   msg = luaO_pushfstring(ls->L, msg, getstr(gt->name), gt->line);
   msg = luaO_pushfstring(ls->L, msg, getstr(gt->name), gt->line);
@@ -1200,7 +1200,7 @@ static void gotostat (LexState *ls, int pc) {
 static void checkrepeated (FuncState *fs, Labellist *ll, TString *label) {
 static void checkrepeated (FuncState *fs, Labellist *ll, TString *label) {
   int i;
   int i;
   for (i = fs->bl->firstlabel; i < ll->n; i++) {
   for (i = fs->bl->firstlabel; i < ll->n; i++) {
-    if (eqstr(label, ll->arr[i].name)) {
+    if (luaS_eqstr(label, ll->arr[i].name)) {
       const char *msg = luaO_pushfstring(fs->ls->L,
       const char *msg = luaO_pushfstring(fs->ls->L,
                           "label " LUA_QS " already defined on line %d",
                           "label " LUA_QS " already defined on line %d",
                           getstr(label), ll->arr[i].line);
                           getstr(label), ll->arr[i].line);

+ 2 - 2
ltable.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: ltable.c,v 2.66 2011/11/28 17:25:48 roberto Exp roberto $
+** $Id: ltable.c,v 2.67 2011/11/30 12:41:45 roberto Exp roberto $
 ** Lua tables (hash)
 ** Lua tables (hash)
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -458,7 +458,7 @@ const TValue *luaH_getint (Table *t, int key) {
 const TValue *luaH_getstr (Table *t, TString *key) {
 const TValue *luaH_getstr (Table *t, TString *key) {
   Node *n = hashstr(t, key);
   Node *n = hashstr(t, key);
   do {  /* check whether `key' is somewhere in the chain */
   do {  /* check whether `key' is somewhere in the chain */
-    if (ttisstring(gkey(n)) && eqstr(rawtsvalue(gkey(n)), key))
+    if (ttisstring(gkey(n)) && luaS_eqstr(rawtsvalue(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);

+ 3 - 3
lvm.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lvm.c,v 2.146 2011/11/29 15:54:38 roberto Exp roberto $
+** $Id: lvm.c,v 2.147 2011/12/07 14:43:55 roberto Exp roberto $
 ** Lua virtual machine
 ** Lua virtual machine
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -258,7 +258,7 @@ int luaV_equalobj_ (lua_State *L, const TValue *t1, const TValue *t2) {
     case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2);  /* true must be 1 !! */
     case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2);  /* true must be 1 !! */
     case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2);
     case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2);
     case LUA_TLCF: return fvalue(t1) == fvalue(t2);
     case LUA_TLCF: return fvalue(t1) == fvalue(t2);
-    case LUA_TSTRING: return eqstr(rawtsvalue(t1), rawtsvalue(t2));
+    case LUA_TSTRING: return luaS_eqstr(rawtsvalue(t1), rawtsvalue(t2));
     case LUA_TUSERDATA: {
     case LUA_TUSERDATA: {
       if (uvalue(t1) == uvalue(t2)) return 1;
       if (uvalue(t1) == uvalue(t2)) return 1;
       else if (L == NULL) return 0;
       else if (L == NULL) return 0;
@@ -293,7 +293,7 @@ void luaV_concat (lua_State *L, int total) {
     else if (tsvalue(top-1)->len == 0)  /* second operand is empty? */
     else if (tsvalue(top-1)->len == 0)  /* second operand is empty? */
       (void)tostring(L, top - 2);  /* result is first operand */
       (void)tostring(L, top - 2);  /* result is first operand */
     else if (ttisstring(top-2) && tsvalue(top-2)->len == 0) {
     else if (ttisstring(top-2) && tsvalue(top-2)->len == 0) {
-      setsvalue2s(L, top-2, rawtsvalue(top-1));  /* result is second op. */
+      setobjs2s(L, top - 2, top - 1);  /* result is second op. */
     }
     }
     else {
     else {
       /* at least two non-empty string values; get as many as possible */
       /* at least two non-empty string values; get as many as possible */