File tree 3 files changed +18
-17
lines changed
3 files changed +18
-17
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- ** $Id: lgc.c,v 2.203 2015/03/04 13:31:21 roberto Exp roberto $
2
+ ** $Id: lgc.c,v 2.204 2015/03/04 13:51:55 roberto Exp roberto $
3
3
** Garbage Collector
4
4
** See Copyright Notice in lua.h
5
5
*/
@@ -977,19 +977,6 @@ void luaC_freeallobjects (lua_State *L) {
977
977
}
978
978
979
979
980
- /*
981
- ** Clear API string cache. (Entries cannot be empty, so fill them with
982
- ** a non-collectable string.)
983
- */
984
- static void clearapihash (global_State * g ) {
985
- int i ;
986
- for (i = 0 ; i < STRCACHE_SIZE ; i ++ ) {
987
- if (iswhite (g -> strcache [i ])) /* will entry be collected? */
988
- g -> strcache [i ] = g -> memerrmsg ; /* replace it with something fixed */
989
- }
990
- }
991
-
992
-
993
980
static l_mem atomic (lua_State * L ) {
994
981
global_State * g = G (L );
995
982
l_mem work ;
@@ -1030,7 +1017,7 @@ static l_mem atomic (lua_State *L) {
1030
1017
/* clear values from resurrected weak tables */
1031
1018
clearvalues (g , g -> weak , origweak );
1032
1019
clearvalues (g , g -> allweak , origall );
1033
- clearapihash (g );
1020
+ luaS_clearcache (g );
1034
1021
g -> currentwhite = cast_byte (otherwhite (g )); /* flip current white */
1035
1022
work += g -> GCmemtrav ; /* complete counting */
1036
1023
return work ; /* estimate of memory marked by 'atomic' */
Original file line number Diff line number Diff line change 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
3
** String table (keeps all strings handled by Lua)
4
4
** See Copyright Notice in lua.h
5
5
*/
@@ -87,6 +87,19 @@ void luaS_resize (lua_State *L, int newsize) {
87
87
}
88
88
89
89
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
+
90
103
/*
91
104
** Initialize the string table and the string cache
92
105
*/
Original file line number Diff line number Diff line change 1
1
/*
2
- ** $Id: lstring.h,v 1.57 2015/01/16 16:54:37 roberto Exp roberto $
2
+ ** $Id: lstring.h,v 1.58 2015/03/04 13:31:21 roberto Exp roberto $
3
3
** String table (keep all strings handled by Lua)
4
4
** See Copyright Notice in lua.h
5
5
*/
36
36
LUAI_FUNC unsigned int luaS_hash (const char * str , size_t l , unsigned int seed );
37
37
LUAI_FUNC int luaS_eqlngstr (TString * a , TString * b );
38
38
LUAI_FUNC void luaS_resize (lua_State * L , int newsize );
39
+ LUAI_FUNC void luaS_clearcache (global_State * g );
39
40
LUAI_FUNC void luaS_init (lua_State * L );
40
41
LUAI_FUNC void luaS_remove (lua_State * L , TString * ts );
41
42
LUAI_FUNC Udata * luaS_newudata (lua_State * L , size_t s );
You can’t perform that action at this time.
0 commit comments