aboutsummaryrefslogtreecommitdiff
path: root/lstring.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2015-03-25 10:42:19 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2015-03-25 10:42:19 -0300
commitb436ed58a3416c2e1936bdce880ac09925401a87 (patch)
treee3c00e30d5260fc54076e8e247e19efc909e4279 /lstring.c
parent2b37f2150ef2630d594628d94b261cd9e6173e5a (diff)
downloadlua-b436ed58a3416c2e1936bdce880ac09925401a87.tar.gz
lua-b436ed58a3416c2e1936bdce880ac09925401a87.tar.bz2
lua-b436ed58a3416c2e1936bdce880ac09925401a87.zip
'clearapihash' -> 'luaS_clearcache' and moved to 'lstring.c' (which
keeps all code related to this cache)
Diffstat (limited to 'lstring.c')
-rw-r--r--lstring.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/lstring.c b/lstring.c
index 638f3dec..5af5050b 100644
--- a/lstring.c
+++ b/lstring.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstring.c,v 2.46 2015/01/16 16:54:37 roberto Exp roberto $ 2** $Id: lstring.c,v 2.47 2015/03/04 13:31:21 roberto Exp roberto $
3** String table (keeps all strings handled by Lua) 3** String table (keeps all strings handled by Lua)
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -88,6 +88,19 @@ void luaS_resize (lua_State *L, int newsize) {
88 88
89 89
90/* 90/*
91** Clear API string cache. (Entries cannot be empty, so fill them with
92** a non-collectable string.)
93*/
94void luaS_clearcache (global_State *g) {
95 int i;
96 for (i = 0; i < STRCACHE_SIZE; i++) {
97 if (iswhite(g->strcache[i])) /* will entry be collected? */
98 g->strcache[i] = g->memerrmsg; /* replace it with something fixed */
99 }
100}
101
102
103/*
91** Initialize the string table and the string cache 104** Initialize the string table and the string cache
92*/ 105*/
93void luaS_init (lua_State *L) { 106void luaS_init (lua_State *L) {