History

Lua 5.3.0-work3

Lua Team committed 12 years ago

Commit f8a66271 parent ad386d945 files · +2323 −1590Browse files

Showing the changes to src/lstring.c (1 of 45 files). Show all

Unified · Split

src/lstring.c+8−4
@@ -1,5 +1,5 @@
11 /*
2−** $Id: lstring.c,v 2.38 2014/03/19 18:51:42 roberto Exp $
2+** $Id: lstring.c,v 2.40 2014/06/18 22:59:29 roberto Exp $
33 ** String table (keeps all strings handled by Lua)
44 ** See Copyright Notice in lua.h
55 */
@@ -90,9 +90,11 @@ void luaS_resize (lua_State *L, int newsize) { · 84 unmodified lines
9090 static TString *createstrobj (lua_State *L, const char *str, size_t l,
9191 int tag, unsigned int h) {
9292 TString *ts;
93+ GCObject *o;
9394 size_t totalsize; /* total size of TString object */
9495 totalsize = sizeof(TString) + ((l + 1) * sizeof(char));
95− ts = &luaC_newobj(L, tag, totalsize)->ts;
96+ o = luaC_newobj(L, tag, totalsize);
97+ ts = rawgco2ts(o);
9698 ts->tsv.len = l;
9799 ts->tsv.hash = h;
98100 ts->tsv.extra = 0;
@@ -102,7 +104,7 @@ static TString *createstrobj (lua_State *L, const char *str, size_t l, · 3 unmodified lines
102104 }
103105
104106
105−LUAI_FUNC void luaS_remove (lua_State *L, TString *ts) {
107+void luaS_remove (lua_State *L, TString *ts) {
106108 stringtable *tb = &G(L)->strt;
107109 TString **p = &tb->hash[lmod(ts->tsv.hash, tb->size)];
108110 while (*p != ts) /* find previous element */
@@ -165,9 +167,11 @@ TString *luaS_new (lua_State *L, const char *str) { · 56 unmodified lines
165167
166168 Udata *luaS_newudata (lua_State *L, size_t s) {
167169 Udata *u;
170+ GCObject *o;
168171 if (s > MAX_SIZE - sizeof(Udata))
169172 luaM_toobig(L);
170− u = &luaC_newobj(L, LUA_TUSERDATA, sizeof(Udata) + s)->u;
173+ o = luaC_newobj(L, LUA_TUSERDATA, sizeof(Udata) + s);
174+ u = rawgco2u(o);
171175 u->uv.len = s;
172176 u->uv.metatable = NULL;
173177 setuservalue(L, u, luaO_nilobject);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t