lua

A copy of the Lua development repository
Log | Files | Refs | README

commit ee5edb6b680589805c8fc348f6a7566c2bd8735d
parent bda83e22c0ab3e6fffbf0a71e5e4a5869da8f6ab
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Thu, 17 Sep 2015 12:50:39 -0300

macros 'getaddrstr' and 'getstr' unified (they do the same thing)

Diffstat:
Mlobject.h | 6+++---
Mlstring.c | 8++++----
Mlundump.c | 4++--
Mlvm.c | 4++--
4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/lobject.h b/lobject.h @@ -1,5 +1,5 @@ /* -** $Id: lobject.h,v 2.112 2015/09/08 15:49:25 roberto Exp roberto $ +** $Id: lobject.h,v 2.113 2015/09/08 16:54:52 roberto Exp roberto $ ** Type definitions for Lua objects ** See Copyright Notice in lua.h */ @@ -325,9 +325,9 @@ typedef union UTString { ** Get the actual string (array of bytes) from a 'TString'. ** (Access to 'extra' ensures that value is really a 'TString'.) */ -#define getaddrstr(ts) (cast(char *, (ts)) + sizeof(UTString)) #define getstr(ts) \ - check_exp(sizeof((ts)->extra), cast(const char*, getaddrstr(ts))) + check_exp(sizeof((ts)->extra), cast(char *, (ts)) + sizeof(UTString)) + /* get the actual string (array of bytes) from a Lua value */ #define svalue(o) getstr(tsvalue(o)) diff --git a/lstring.c b/lstring.c @@ -1,5 +1,5 @@ /* -** $Id: lstring.c,v 2.50 2015/06/18 14:20:32 roberto Exp roberto $ +** $Id: lstring.c,v 2.51 2015/09/08 15:41:05 roberto Exp roberto $ ** String table (keeps all strings handled by Lua) ** See Copyright Notice in lua.h */ @@ -128,7 +128,7 @@ static TString *createstrobj (lua_State *L, size_t l, int tag, unsigned int h) { ts = gco2ts(o); ts->hash = h; ts->extra = 0; - getaddrstr(ts)[l] = '\0'; /* ending 0 */ + getstr(ts)[l] = '\0'; /* ending 0 */ return ts; } @@ -172,7 +172,7 @@ static TString *internshrstr (lua_State *L, const char *str, size_t l) { list = &g->strt.hash[lmod(h, g->strt.size)]; /* recompute with new size */ } ts = createstrobj(L, l, LUA_TSHRSTR, h); - memcpy(getaddrstr(ts), str, l * sizeof(char)); + memcpy(getstr(ts), str, l * sizeof(char)); ts->shrlen = cast_byte(l); ts->u.hnext = *list; *list = ts; @@ -192,7 +192,7 @@ TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { if (l >= (MAX_SIZE - sizeof(TString))/sizeof(char)) luaM_toobig(L); ts = luaS_createlngstrobj(L, l); - memcpy(getaddrstr(ts), str, l * sizeof(char)); + memcpy(getstr(ts), str, l * sizeof(char)); return ts; } } diff --git a/lundump.c b/lundump.c @@ -1,5 +1,5 @@ /* -** $Id: lundump.c,v 2.41 2014/11/02 19:19:04 roberto Exp roberto $ +** $Id: lundump.c,v 2.42 2015/09/08 15:41:05 roberto Exp roberto $ ** load precompiled Lua chunks ** See Copyright Notice in lua.h */ @@ -98,7 +98,7 @@ static TString *LoadString (LoadState *S) { } else { /* long string */ TString *ts = luaS_createlngstrobj(S->L, size); - LoadVector(S, getaddrstr(ts), size); /* load directly in final place */ + LoadVector(S, getstr(ts), size); /* load directly in final place */ return ts; } } diff --git a/lvm.c b/lvm.c @@ -1,5 +1,5 @@ /* -** $Id: lvm.c,v 2.251 2015/09/08 15:41:05 roberto Exp roberto $ +** $Id: lvm.c,v 2.252 2015/09/09 13:44:07 roberto Exp roberto $ ** Lua virtual machine ** See Copyright Notice in lua.h */ @@ -487,7 +487,7 @@ void luaV_concat (lua_State *L, int total) { } else { /* long string; copy strings directly to final result */ ts = luaS_createlngstrobj(L, tl); - copy2buff(top, n, getaddrstr(ts)); + copy2buff(top, n, getstr(ts)); } setsvalue2s(L, top - n, ts); /* create result */ }