diff --git a/src/blua/lgc.c b/src/blua/lgc.c index cb7a878f9..26af8135b 100644 --- a/src/blua/lgc.c +++ b/src/blua/lgc.c @@ -522,19 +522,6 @@ static void remarkupvals (global_State *g) { } -/* -** Clear API string cache. (Entries cannot be empty, so fill them with -** a non-collectable string.) -*/ -static void clearapihash (global_State *g) { - int i; - for (i = 0; i < STRCACHE_SIZE; i++) { - if (luaS_iswhite(g->strcache[i])) /* will entry be collected? */ - g->strcache[i] = g->memerrmsg; /* replace it with something fixed */ - } -} - - static void atomic (lua_State *L) { global_State *g = G(L); size_t udsize; /* total size of userdata to be finalized */ @@ -557,7 +544,7 @@ static void atomic (lua_State *L) { marktmu(g); /* mark `preserved' userdata */ udsize += propagateall(g); /* remark, to propagate `preserveness' */ cleartable(g->weak); /* remove collected objects from weak tables */ - clearapihash(g); + luaS_clearcache(g); /* flip current white */ g->currentwhite = cast_byte(otherwhite(g)); g->sweepstrgc = 0; diff --git a/src/blua/lstring.c b/src/blua/lstring.c index 4cec90597..238e3ddcc 100644 --- a/src/blua/lstring.c +++ b/src/blua/lstring.c @@ -75,6 +75,19 @@ static TString *newlstr (lua_State *L, const char *str, size_t l, } +/* +** Clear API string cache. (Entries cannot be empty, so fill them with +** a non-collectable string.) +*/ +void luaS_clearcache (global_State *g) { + int i; + for (i = 0; i < STRCACHE_SIZE; i++) { + if (luaS_iswhite(g->strcache[i])) /* will entry be collected? */ + g->strcache[i] = g->memerrmsg; /* replace it with something fixed */ + } +} + + /* ** Initialize the string table and the string cache */ diff --git a/src/blua/lstring.h b/src/blua/lstring.h index d794e158a..42e88d538 100644 --- a/src/blua/lstring.h +++ b/src/blua/lstring.h @@ -25,6 +25,7 @@ #define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT) LUAI_FUNC void luaS_resize (lua_State *L, int newsize); +LUAI_FUNC void luaS_clearcache (global_State *g); LUAI_FUNC void luaS_init (lua_State *L); LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e); LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l);