diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-12-10 10:13:36 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-12-10 10:13:36 -0200 |
commit | 47fc57a2529c83376883f36954082cfe80ae588f (patch) | |
tree | c2e57e2f9f7d78279144bfd9cbd04a3b1b131f12 /lstring.c | |
parent | 4d5fe1f54bc00850f77a7c42f9e95d0ff3f1ab5b (diff) | |
download | lua-47fc57a2529c83376883f36954082cfe80ae588f.tar.gz lua-47fc57a2529c83376883f36954082cfe80ae588f.tar.bz2 lua-47fc57a2529c83376883f36954082cfe80ae588f.zip |
`TObject' renamed to `TValue' + other name changes and better assertions
for incremental garbage collection
Diffstat (limited to 'lstring.c')
-rw-r--r-- | lstring.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstring.c,v 1.84 2003/12/04 17:22:42 roberto Exp roberto $ | 2 | ** $Id: lstring.c,v 1.85 2003/12/09 16:56:11 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 | */ |
@@ -37,7 +37,7 @@ void luaS_resize (lua_State *L, int newsize) { | |||
37 | GCObject *p = tb->hash[i]; | 37 | GCObject *p = tb->hash[i]; |
38 | while (p) { /* for each node in the list */ | 38 | while (p) { /* for each node in the list */ |
39 | GCObject *next = p->gch.next; /* save next */ | 39 | GCObject *next = p->gch.next; /* save next */ |
40 | unsigned int h = gcotots(p)->tsv.hash; | 40 | unsigned int h = gco2ts(p)->hash; |
41 | int h1 = lmod(h, newsize); /* new position */ | 41 | int h1 = lmod(h, newsize); /* new position */ |
42 | lua_assert(cast(int, h%newsize) == lmod(h, newsize)); | 42 | lua_assert(cast(int, h%newsize) == lmod(h, newsize)); |
43 | p->gch.next = newhash[h1]; /* chain it */ | 43 | p->gch.next = newhash[h1]; /* chain it */ |
@@ -65,7 +65,7 @@ static TString *newlstr (lua_State *L, const char *str, size_t l, | |||
65 | tb = &G(L)->strt; | 65 | tb = &G(L)->strt; |
66 | h = lmod(h, tb->size); | 66 | h = lmod(h, tb->size); |
67 | ts->tsv.next = tb->hash[h]; /* chain new entry */ | 67 | ts->tsv.next = tb->hash[h]; /* chain new entry */ |
68 | tb->hash[h] = valtogco(ts); | 68 | tb->hash[h] = obj2gco(ts); |
69 | tb->nuse++; | 69 | tb->nuse++; |
70 | if (tb->nuse > cast(lu_int32, tb->size) && tb->size <= MAX_INT/2) | 70 | if (tb->nuse > cast(lu_int32, tb->size) && tb->size <= MAX_INT/2) |
71 | luaS_resize(L, tb->size*2); /* too crowded */ | 71 | luaS_resize(L, tb->size*2); /* too crowded */ |
@@ -83,7 +83,7 @@ TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { | |||
83 | for (o = G(L)->strt.hash[lmod(h, G(L)->strt.size)]; | 83 | for (o = G(L)->strt.hash[lmod(h, G(L)->strt.size)]; |
84 | o != NULL; | 84 | o != NULL; |
85 | o = o->gch.next) { | 85 | o = o->gch.next) { |
86 | TString *ts = gcotots(o); | 86 | TString *ts = rawgco2ts(o); |
87 | if (ts->tsv.len == l && (memcmp(str, getstr(ts), l) == 0)) { | 87 | if (ts->tsv.len == l && (memcmp(str, getstr(ts), l) == 0)) { |
88 | /* string may be dead */ | 88 | /* string may be dead */ |
89 | if (isdead(G(L), o)) changewhite(o); | 89 | if (isdead(G(L), o)) changewhite(o); |
@@ -103,7 +103,7 @@ Udata *luaS_newudata (lua_State *L, size_t s) { | |||
103 | u->uv.metatable = NULL; | 103 | u->uv.metatable = NULL; |
104 | /* chain it on udata list */ | 104 | /* chain it on udata list */ |
105 | u->uv.next = G(L)->firstudata->uv.next; | 105 | u->uv.next = G(L)->firstudata->uv.next; |
106 | G(L)->firstudata->uv.next = valtogco(u); | 106 | G(L)->firstudata->uv.next = obj2gco(u); |
107 | return u; | 107 | return u; |
108 | } | 108 | } |
109 | 109 | ||