diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-09-17 12:51:05 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-09-17 12:51:05 -0300 |
| commit | ee5edb6b680589805c8fc348f6a7566c2bd8735d (patch) | |
| tree | ca0d801e40a0dcf98c4594bdaf97933193bfea71 /lstring.c | |
| parent | bda83e22c0ab3e6fffbf0a71e5e4a5869da8f6ab (diff) | |
| download | lua-ee5edb6b680589805c8fc348f6a7566c2bd8735d.tar.gz lua-ee5edb6b680589805c8fc348f6a7566c2bd8735d.tar.bz2 lua-ee5edb6b680589805c8fc348f6a7566c2bd8735d.zip | |
macros 'getaddrstr' and 'getstr' unified (they do the same thing)
Diffstat (limited to 'lstring.c')
| -rw-r--r-- | lstring.c | 8 |
1 files changed, 4 insertions, 4 deletions
| @@ -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 | } |
