diff options
-rw-r--r-- | lobject.h | 6 | ||||
-rw-r--r-- | lstring.c | 8 | ||||
-rw-r--r-- | lundump.c | 4 | ||||
-rw-r--r-- | lvm.c | 4 |
4 files changed, 11 insertions, 11 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.h,v 2.112 2015/09/08 15:49:25 roberto Exp roberto $ | 2 | ** $Id: lobject.h,v 2.113 2015/09/08 16:54:52 roberto Exp roberto $ |
3 | ** Type definitions for Lua objects | 3 | ** Type definitions for Lua objects |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -325,9 +325,9 @@ typedef union UTString { | |||
325 | ** Get the actual string (array of bytes) from a 'TString'. | 325 | ** Get the actual string (array of bytes) from a 'TString'. |
326 | ** (Access to 'extra' ensures that value is really a 'TString'.) | 326 | ** (Access to 'extra' ensures that value is really a 'TString'.) |
327 | */ | 327 | */ |
328 | #define getaddrstr(ts) (cast(char *, (ts)) + sizeof(UTString)) | ||
329 | #define getstr(ts) \ | 328 | #define getstr(ts) \ |
330 | check_exp(sizeof((ts)->extra), cast(const char*, getaddrstr(ts))) | 329 | check_exp(sizeof((ts)->extra), cast(char *, (ts)) + sizeof(UTString)) |
330 | |||
331 | 331 | ||
332 | /* get the actual string (array of bytes) from a Lua value */ | 332 | /* get the actual string (array of bytes) from a Lua value */ |
333 | #define svalue(o) getstr(tsvalue(o)) | 333 | #define svalue(o) getstr(tsvalue(o)) |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstring.c,v 2.50 2015/06/18 14:20:32 roberto Exp roberto $ | 2 | ** $Id: lstring.c,v 2.51 2015/09/08 15:41:05 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 | */ |
@@ -128,7 +128,7 @@ static TString *createstrobj (lua_State *L, size_t l, int tag, unsigned int h) { | |||
128 | ts = gco2ts(o); | 128 | ts = gco2ts(o); |
129 | ts->hash = h; | 129 | ts->hash = h; |
130 | ts->extra = 0; | 130 | ts->extra = 0; |
131 | getaddrstr(ts)[l] = '\0'; /* ending 0 */ | 131 | getstr(ts)[l] = '\0'; /* ending 0 */ |
132 | return ts; | 132 | return ts; |
133 | } | 133 | } |
134 | 134 | ||
@@ -172,7 +172,7 @@ static TString *internshrstr (lua_State *L, const char *str, size_t l) { | |||
172 | list = &g->strt.hash[lmod(h, g->strt.size)]; /* recompute with new size */ | 172 | list = &g->strt.hash[lmod(h, g->strt.size)]; /* recompute with new size */ |
173 | } | 173 | } |
174 | ts = createstrobj(L, l, LUA_TSHRSTR, h); | 174 | ts = createstrobj(L, l, LUA_TSHRSTR, h); |
175 | memcpy(getaddrstr(ts), str, l * sizeof(char)); | 175 | memcpy(getstr(ts), str, l * sizeof(char)); |
176 | ts->shrlen = cast_byte(l); | 176 | ts->shrlen = cast_byte(l); |
177 | ts->u.hnext = *list; | 177 | ts->u.hnext = *list; |
178 | *list = ts; | 178 | *list = ts; |
@@ -192,7 +192,7 @@ TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { | |||
192 | if (l >= (MAX_SIZE - sizeof(TString))/sizeof(char)) | 192 | if (l >= (MAX_SIZE - sizeof(TString))/sizeof(char)) |
193 | luaM_toobig(L); | 193 | luaM_toobig(L); |
194 | ts = luaS_createlngstrobj(L, l); | 194 | ts = luaS_createlngstrobj(L, l); |
195 | memcpy(getaddrstr(ts), str, l * sizeof(char)); | 195 | memcpy(getstr(ts), str, l * sizeof(char)); |
196 | return ts; | 196 | return ts; |
197 | } | 197 | } |
198 | } | 198 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lundump.c,v 2.41 2014/11/02 19:19:04 roberto Exp roberto $ | 2 | ** $Id: lundump.c,v 2.42 2015/09/08 15:41:05 roberto Exp roberto $ |
3 | ** load precompiled Lua chunks | 3 | ** load precompiled Lua chunks |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -98,7 +98,7 @@ static TString *LoadString (LoadState *S) { | |||
98 | } | 98 | } |
99 | else { /* long string */ | 99 | else { /* long string */ |
100 | TString *ts = luaS_createlngstrobj(S->L, size); | 100 | TString *ts = luaS_createlngstrobj(S->L, size); |
101 | LoadVector(S, getaddrstr(ts), size); /* load directly in final place */ | 101 | LoadVector(S, getstr(ts), size); /* load directly in final place */ |
102 | return ts; | 102 | return ts; |
103 | } | 103 | } |
104 | } | 104 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.251 2015/09/08 15:41:05 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.252 2015/09/09 13:44:07 roberto Exp roberto $ |
3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -487,7 +487,7 @@ void luaV_concat (lua_State *L, int total) { | |||
487 | } | 487 | } |
488 | else { /* long string; copy strings directly to final result */ | 488 | else { /* long string; copy strings directly to final result */ |
489 | ts = luaS_createlngstrobj(L, tl); | 489 | ts = luaS_createlngstrobj(L, tl); |
490 | copy2buff(top, n, getaddrstr(ts)); | 490 | copy2buff(top, n, getstr(ts)); |
491 | } | 491 | } |
492 | setsvalue2s(L, top - n, ts); /* create result */ | 492 | setsvalue2s(L, top - n, ts); /* create result */ |
493 | } | 493 | } |