aboutsummaryrefslogtreecommitdiff
path: root/ltests.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-03-13 13:16:53 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-03-13 13:16:53 -0300
commitcf71a5ddc742692fad813f89f1c9ef53e1ffde0f (patch)
treedf02305ff3cf05908f21829384e3a7f8699d2331 /ltests.c
parent2c32bff60987d38a60a58d4f0123f3783da60a63 (diff)
downloadlua-cf71a5ddc742692fad813f89f1c9ef53e1ffde0f.tar.gz
lua-cf71a5ddc742692fad813f89f1c9ef53e1ffde0f.tar.bz2
lua-cf71a5ddc742692fad813f89f1c9ef53e1ffde0f.zip
Details
Several small improvements (code style, warnings, comments, more tests), in particular: - 'lua_topointer' extended to handle strings - raises an error in 'string.format("%10q")' ('%q' with modifiers) - in the manual for 'string.format', the term "option" replaced by "conversion specifier" (the term used by the C standard)
Diffstat (limited to 'ltests.c')
-rw-r--r--ltests.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/ltests.c b/ltests.c
index 36a974ae..23375382 100644
--- a/ltests.c
+++ b/ltests.c
@@ -164,7 +164,7 @@ typedef union Header {
164 164
165 165
166Memcontrol l_memcontrol = 166Memcontrol l_memcontrol =
167 {0L, 0L, 0L, 0L, (~0L), {0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L}}; 167 {0UL, 0UL, 0UL, 0UL, (~0UL), {0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL}};
168 168
169 169
170static void freeblock (Memcontrol *mc, Header *block) { 170static void freeblock (Memcontrol *mc, Header *block) {
@@ -1596,7 +1596,10 @@ static struct X { int x; } x;
1596 lua_pushnumber(L1, lua_tonumber(L1, getindex)); 1596 lua_pushnumber(L1, lua_tonumber(L1, getindex));
1597 } 1597 }
1598 else if EQ("topointer") { 1598 else if EQ("topointer") {
1599 lua_pushnumber(L1, cast_sizet(lua_topointer(L1, getindex))); 1599 lua_pushlightuserdata(L1, cast_voidp(lua_topointer(L1, getindex)));
1600 }
1601 else if EQ("touserdata") {
1602 lua_pushlightuserdata(L1, lua_touserdata(L1, getindex));
1600 } 1603 }
1601 else if EQ("tostring") { 1604 else if EQ("tostring") {
1602 const char *s = lua_tostring(L1, getindex); 1605 const char *s = lua_tostring(L1, getindex);