diff options
| author | Mike Pall <mike> | 2009-12-08 19:49:20 +0100 |
|---|---|---|
| committer | Mike Pall <mike> | 2009-12-08 19:49:20 +0100 |
| commit | 1d1fed48a002dfc0919135911057ebc255a53e0a (patch) | |
| tree | c5c6643908374bb8f02f4c7691332d32f6645986 /src/lib_string.c | |
| parent | 55b16959717084884fd4a0cbae6d19e3786c20c7 (diff) | |
| download | luajit-2.0.0-beta2.tar.gz luajit-2.0.0-beta2.tar.bz2 luajit-2.0.0-beta2.zip | |
RELEASE LuaJIT-2.0.0-beta2v2.0.0-beta2
Diffstat (limited to '')
| -rw-r--r-- | src/lib_string.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lib_string.c b/src/lib_string.c index fdd7fbcb..6c857328 100644 --- a/src/lib_string.c +++ b/src/lib_string.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include "lualib.h" | 16 | #include "lualib.h" |
| 17 | 17 | ||
| 18 | #include "lj_obj.h" | 18 | #include "lj_obj.h" |
| 19 | #include "lj_gc.h" | ||
| 19 | #include "lj_err.h" | 20 | #include "lj_err.h" |
| 20 | #include "lj_str.h" | 21 | #include "lj_str.h" |
| 21 | #include "lj_tab.h" | 22 | #include "lj_tab.h" |
| @@ -774,6 +775,7 @@ LJLIB_CF(string_format) | |||
| 774 | LUALIB_API int luaopen_string(lua_State *L) | 775 | LUALIB_API int luaopen_string(lua_State *L) |
| 775 | { | 776 | { |
| 776 | GCtab *mt; | 777 | GCtab *mt; |
| 778 | GCstr *mmstr; | ||
| 777 | LJ_LIB_REG(L, string); | 779 | LJ_LIB_REG(L, string); |
| 778 | #if defined(LUA_COMPAT_GFIND) | 780 | #if defined(LUA_COMPAT_GFIND) |
| 779 | lua_getfield(L, -1, "gmatch"); | 781 | lua_getfield(L, -1, "gmatch"); |
| @@ -782,8 +784,9 @@ LUALIB_API int luaopen_string(lua_State *L) | |||
| 782 | mt = lj_tab_new(L, 0, 1); | 784 | mt = lj_tab_new(L, 0, 1); |
| 783 | /* NOBARRIER: G(L)->mmname[] is a GC root. */ | 785 | /* NOBARRIER: G(L)->mmname[] is a GC root. */ |
| 784 | setgcref(G(L)->basemt[~LJ_TSTR], obj2gco(mt)); | 786 | setgcref(G(L)->basemt[~LJ_TSTR], obj2gco(mt)); |
| 785 | settabV(L, lj_tab_setstr(L, mt, strref(G(L)->mmname[MM_index])), | 787 | mmstr = strref(G(L)->mmname[MM_index]); |
| 786 | tabV(L->top-1)); | 788 | if (isdead(G(L), obj2gco(mmstr))) flipwhite(obj2gco(mmstr)); |
| 789 | settabV(L, lj_tab_setstr(L, mt, mmstr), tabV(L->top-1)); | ||
| 787 | mt->nomm = cast_byte(~(1u<<MM_index)); | 790 | mt->nomm = cast_byte(~(1u<<MM_index)); |
| 788 | return 1; | 791 | return 1; |
| 789 | } | 792 | } |
