diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-09 18:22:29 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-09 18:22:29 -0200 |
| commit | d2e340f467a46017fa3526074c1756124e569880 (patch) | |
| tree | e5b08773a0f0734193b0c1c435fab8ee243f08dc /ltests.c | |
| parent | 6875fdc8be9029b1bb29379c59d5409a0df42c10 (diff) | |
| download | lua-d2e340f467a46017fa3526074c1756124e569880.tar.gz lua-d2e340f467a46017fa3526074c1756124e569880.tar.bz2 lua-d2e340f467a46017fa3526074c1756124e569880.zip | |
string pointers are always fully aligned
Diffstat (limited to 'ltests.c')
| -rw-r--r-- | ltests.c | 8 |
1 files changed, 5 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltests.c,v 1.64 2001/02/06 18:18:58 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 1.65 2001/02/09 19:53:16 roberto Exp roberto $ |
| 3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -201,7 +201,7 @@ static int liststrings (lua_State *L) { | |||
| 201 | lua_newtable(L); | 201 | lua_newtable(L); |
| 202 | for (i=0; i<p->sizekstr; i++) { | 202 | for (i=0; i<p->sizekstr; i++) { |
| 203 | lua_pushnumber(L, i+1); | 203 | lua_pushnumber(L, i+1); |
| 204 | lua_pushstring(L, p->kstr[i]->str); | 204 | lua_pushstring(L, getstr(p->kstr[i])); |
| 205 | lua_settable(L, -3); | 205 | lua_settable(L, -3); |
| 206 | } | 206 | } |
| 207 | return 1; | 207 | return 1; |
| @@ -537,7 +537,9 @@ static int testC (lua_State *L) { | |||
| 537 | lua_pushnumber(L, lua_tonumber(L, getnum)); | 537 | lua_pushnumber(L, lua_tonumber(L, getnum)); |
| 538 | } | 538 | } |
| 539 | else if EQ("tostring") { | 539 | else if EQ("tostring") { |
| 540 | lua_pushstring(L, lua_tostring(L, getnum)); | 540 | const char *s = lua_tostring(L, getnum); |
| 541 | lua_assert((unsigned long)s % 4 == 0); /* check alignment */ | ||
| 542 | lua_pushstring(L, s); | ||
| 541 | } | 543 | } |
| 542 | else if EQ("tonumber") { | 544 | else if EQ("tonumber") { |
| 543 | lua_pushnumber(L, lua_tonumber(L, getnum)); | 545 | lua_pushnumber(L, lua_tonumber(L, getnum)); |
