'clearapihash' -> 'luaS_clearcache' and moved to 'lstring.c' (which

keeps all code related to this cache)
This commit is contained in:
Roberto Ierusalimschy
2015-03-25 10:42:19 -03:00
parent 2b37f2150e
commit b436ed58a3
3 changed files with 18 additions and 17 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: lstring.c,v 2.46 2015/01/16 16:54:37 roberto Exp roberto $
** $Id: lstring.c,v 2.47 2015/03/04 13:31:21 roberto Exp roberto $
** String table (keeps all strings handled by Lua)
** See Copyright Notice in lua.h
*/
@@ -87,6 +87,19 @@ void luaS_resize (lua_State *L, int newsize) {
}
/*
** 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 (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
*/