| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | /* | |
| 2 | - ** $Id: lcode.c,v 2.25.1.3 2007/12/28 15:32:23 roberto Exp $ | ||
| 2 | + ** $Id: lcode.c,v 2.25.1.5 2011/01/31 14:53:16 roberto Exp $ | ||
| 3 | 3 | ** Code generator for Lua | |
| 4 | 4 | ** See Copyright Notice in lua.h | |
| 5 | 5 | */ | |
@@ -544,10 +544,6 @@ void luaK_goiftrue (FuncState *fs, expdesc *e) { | |||
| 544 | 544 | pc = NO_JUMP; /* always true; do nothing */ | |
| 545 | 545 | break; | |
| 546 | 546 | } | |
| 547 | - case VFALSE: { | ||
| 548 | - pc = luaK_jump(fs); /* always jump */ | ||
| 549 | - break; | ||
| 550 | - } | ||
| 551 | 547 | case VJMP: { | |
| 552 | 548 | invertjump(fs, e); | |
| 553 | 549 | pc = e->u.s.info; | |
@@ -572,10 +568,6 @@ static void luaK_goiffalse (FuncState *fs, expdesc *e) { | |||
| 572 | 568 | pc = NO_JUMP; /* always false; do nothing */ | |
| 573 | 569 | break; | |
| 574 | 570 | } | |
| 575 | - case VTRUE: { | ||
| 576 | - pc = luaK_jump(fs); /* always jump */ | ||
| 577 | - break; | ||
| 578 | - } | ||
| 579 | 571 | case VJMP: { | |
| 580 | 572 | pc = e->u.s.info; | |
| 581 | 573 | break; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | /* | |
| 2 | - ** $Id: ldblib.c,v 1.104.1.3 2008/01/21 13:11:21 roberto Exp $ | ||
| 2 | + ** $Id: ldblib.c,v 1.104.1.4 2009/08/04 18:50:18 roberto Exp $ | ||
| 3 | 3 | ** Interface from Lua to its debug API | |
| 4 | 4 | ** See Copyright Notice in lua.h | |
| 5 | 5 | */ | |
@@ -45,6 +45,7 @@ static int db_setmetatable (lua_State *L) { | |||
| 45 | 45 | ||
| 46 | 46 | ||
| 47 | 47 | static int db_getfenv (lua_State *L) { | |
| 48 | + luaL_checkany(L, 1); | ||
| 48 | 49 | lua_getfenv(L, 1); | |
| 49 | 50 | return 1; | |
| 50 | 51 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | /* | |
| 2 | - ** $Id: liolib.c,v 2.73.1.3 2008/01/18 17:47:43 roberto Exp $ | ||
| 2 | + ** $Id: liolib.c,v 2.73.1.4 2010/05/14 15:33:51 roberto Exp $ | ||
| 3 | 3 | ** Standard I/O (and system) library | |
| 4 | 4 | ** See Copyright Notice in lua.h | |
| 5 | 5 | */ | |
@@ -276,7 +276,10 @@ static int read_number (lua_State *L, FILE *f) { | |||
| 276 | 276 | lua_pushnumber(L, d); | |
| 277 | 277 | return 1; | |
| 278 | 278 | } | |
| 279 | - else return 0; /* read fails */ | ||
| 279 | + else { | ||
| 280 | + lua_pushnil(L); /* "result" to be removed */ | ||
| 281 | + return 0; /* read fails */ | ||
| 282 | + } | ||
| 280 | 283 | } | |
| 281 | 284 | ||
| 282 | 285 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | /* | |
| 2 | - ** $Id: llex.c,v 2.20.1.1 2007/12/27 13:02:25 roberto Exp $ | ||
| 2 | + ** $Id: llex.c,v 2.20.1.2 2009/11/23 14:58:22 roberto Exp $ | ||
| 3 | 3 | ** Lexical Analyzer | |
| 4 | 4 | ** See Copyright Notice in lua.h | |
| 5 | 5 | */ | |
@@ -118,8 +118,10 @@ TString *luaX_newstring (LexState *ls, const char *str, size_t l) { | |||
| 118 | 118 | lua_State *L = ls->L; | |
| 119 | 119 | TString *ts = luaS_newlstr(L, str, l); | |
| 120 | 120 | TValue *o = luaH_setstr(L, ls->fs->h, ts); /* entry for `str' */ | |
| 121 | - if (ttisnil(o)) | ||
| 121 | + if (ttisnil(o)) { | ||
| 122 | 122 | setbvalue(o, 1); /* make sure `str' will not be collected */ | |
| 123 | + luaC_checkGC(L); | ||
| 124 | + } | ||
| 123 | 125 | return ts; | |
| 124 | 126 | } | |
| 125 | 127 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | /* | |
| 2 | - ** $Id: loadlib.c,v 1.52.1.3 2008/08/06 13:29:28 roberto Exp $ | ||
| 2 | + ** $Id: loadlib.c,v 1.52.1.4 2009/09/09 13:17:16 roberto Exp $ | ||
| 3 | 3 | ** Dynamic library loader for Lua | |
| 4 | 4 | ** See Copyright Notice in lua.h | |
| 5 | 5 | ** | |
@@ -639,7 +639,7 @@ LUALIB_API int luaopen_package (lua_State *L) { | |||
| 639 | 639 | lua_pushvalue(L, -1); | |
| 640 | 640 | lua_replace(L, LUA_ENVIRONINDEX); | |
| 641 | 641 | /* create `loaders' table */ | |
| 642 | - lua_createtable(L, 0, sizeof(loaders)/sizeof(loaders[0]) - 1); | ||
| 642 | + lua_createtable(L, sizeof(loaders)/sizeof(loaders[0]) - 1, 0); | ||
| 643 | 643 | /* fill it with pre-defined loaders */ | |
| 644 | 644 | for (i=0; loaders[i] != NULL; i++) { | |
| 645 | 645 | lua_pushcfunction(L, loaders[i]); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -679,7 +679,7 @@ LUALIB_API int luaopen_package (lua_State *L) { | |||
| 679 | 679 | lua_pushvalue(L, -1); | |
| 680 | 680 | lua_replace(L, LUA_ENVIRONINDEX); | |
| 681 | 681 | /* create `loaders' table */ | |
| 682 | - lua_createtable(L, 0, sizeof(loaders)/sizeof(loaders[0]) - 1); | ||
| 682 | + lua_createtable(L, sizeof(loaders)/sizeof(loaders[0]) - 1, 0); | ||
| 683 | 683 | /* fill it with pre-defined loaders */ | |
| 684 | 684 | for (i=0; loaders[i] != NULL; i++) { | |
| 685 | 685 | lua_pushcfunction(L, loaders[i]); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | /* | |
| 2 | - ** $Id: lstrlib.c,v 1.132.1.4 2008/07/11 17:27:21 roberto Exp $ | ||
| 2 | + ** $Id: lstrlib.c,v 1.132.1.5 2010/05/14 15:34:19 roberto Exp $ | ||
| 3 | 3 | ** Standard library for string operations and pattern-matching | |
| 4 | 4 | ** See Copyright Notice in lua.h | |
| 5 | 5 | */ | |
@@ -754,6 +754,7 @@ static void addintlen (char *form) { | |||
| 754 | 754 | ||
| 755 | 755 | ||
| 756 | 756 | static int str_format (lua_State *L) { | |
| 757 | + int top = lua_gettop(L); | ||
| 757 | 758 | int arg = 1; | |
| 758 | 759 | size_t sfl; | |
| 759 | 760 | const char *strfrmt = luaL_checklstring(L, arg, &sfl); | |
@@ -768,7 +769,8 @@ static int str_format (lua_State *L) { | |||
| 768 | 769 | else { /* format item */ | |
| 769 | 770 | char form[MAX_FORMAT]; /* to store the format (`%...') */ | |
| 770 | 771 | char buff[MAX_ITEM]; /* to store the formatted item */ | |
| 771 | - arg++; | ||
| 772 | + if (++arg > top) | ||
| 773 | + luaL_argerror(L, arg, "no value"); | ||
| 772 | 774 | strfrmt = scanformat(L, strfrmt, form); | |
| 773 | 775 | switch (*strfrmt++) { | |
| 774 | 776 | case 'c': { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | /* | |
| 2 | - ** $Id: lvm.c,v 2.63.1.3 2007/12/28 15:32:23 roberto Exp $ | ||
| 2 | + ** $Id: lvm.c,v 2.63.1.4 2009/07/01 21:10:33 roberto Exp $ | ||
| 3 | 3 | ** Lua virtual machine | |
| 4 | 4 | ** See Copyright Notice in lua.h | |
| 5 | 5 | */ | |
@@ -133,6 +133,7 @@ void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) { | |||
| 133 | 133 | ||
| 134 | 134 | void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) { | |
| 135 | 135 | int loop; | |
| 136 | + TValue temp; | ||
| 136 | 137 | for (loop = 0; loop < MAXTAGLOOP; loop++) { | |
| 137 | 138 | const TValue *tm; | |
| 138 | 139 | if (ttistable(t)) { /* `t' is a table? */ | |
@@ -152,7 +153,9 @@ void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) { | |||
| 152 | 153 | callTM(L, tm, t, key, val); | |
| 153 | 154 | return; | |
| 154 | 155 | } | |
| 155 | - t = tm; /* else repeat with `tm' */ | ||
| 156 | + /* else repeat with `tm' */ | ||
| 157 | + setobj(L, &temp, tm); /* avoid pointing inside table (may rehash) */ | ||
| 158 | + t = &temp; | ||
| 156 | 159 | } | |
| 157 | 160 | luaG_runerror(L, "loop in settable"); | |
| 158 | 161 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments