diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-03-25 10:42:19 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-03-25 10:42:19 -0300 |
commit | b436ed58a3416c2e1936bdce880ac09925401a87 (patch) | |
tree | e3c00e30d5260fc54076e8e247e19efc909e4279 /lstring.c | |
parent | 2b37f2150ef2630d594628d94b261cd9e6173e5a (diff) | |
download | lua-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.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -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 | */ | ||
94 | void 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 | */ |
93 | void luaS_init (lua_State *L) { | 106 | void luaS_init (lua_State *L) { |