Details
Several small changes from feedback on 5.4 alhpa rc1 (warnings,
typos in the manual, and the like)
diff --git a/ldebug.c b/ldebug.c
index 6cd4e07..acaa653 100644
--- a/ldebug.c
+++ b/ldebug.c
@@ -373,6 +373,7 @@
ar->ftransfer = ci->u2.transferinfo.ftransfer;
ar->ntransfer = ci->u2.transferinfo.ntransfer;
}
+ break;
}
case 'L':
case 'f': /* handled by lua_getinfo */
@@ -525,8 +526,8 @@
}
- const char *getobjname (const Proto *p, int lastpc, int reg,
- const char **name) {
+static const char *getobjname (const Proto *p, int lastpc, int reg,
+ const char **name) {
int pc;
*name = luaF_getlocalname(p, reg + 1, lastpc);
if (*name) /* is a local? */
diff --git a/lgc.c b/lgc.c
index e9189ac..69d8a18 100644
--- a/lgc.c
+++ b/lgc.c
@@ -484,8 +484,8 @@
const TValue *mode = gfasttm(g, h->metatable, TM_MODE);
markobjectN(g, h->metatable);
if (mode && ttisstring(mode) && /* is there a weak mode? */
- ((weakkey = strchr(svalue(mode), 'k')),
- (weakvalue = strchr(svalue(mode), 'v')),
+ (cast_void(weakkey = strchr(svalue(mode), 'k')),
+ cast_void(weakvalue = strchr(svalue(mode), 'v')),
(weakkey || weakvalue))) { /* is really weak? */
black2gray(h); /* keep table gray */
if (!weakkey) /* strong keys? */
diff --git a/llex.c b/llex.c
index 226127f..d99d901 100644
--- a/llex.c
+++ b/llex.c
@@ -29,7 +29,7 @@
-#define next(ls) (ls->current = zgetc(ls->z))
+#define next(ls) (ls->current = zgetc(ls->z))
@@ -337,7 +337,7 @@
save_and_next(ls); /* skip 'u' */
esccheck(ls, ls->current == '{', "missing '{'");
r = gethexa(ls); /* must have at least one digit */
- while ((save_and_next(ls), lisxdigit(ls->current))) {
+ while (cast_void(save_and_next(ls)), lisxdigit(ls->current)) {
i++;
esccheck(ls, r <= (0x7FFFFFFFu >> 4), "UTF-8 value too large");
r = (r << 4) + luaO_hexavalue(ls->current);
diff --git a/lobject.c b/lobject.c
index 979a688..2c265f9 100644
--- a/lobject.c
+++ b/lobject.c
@@ -366,8 +366,8 @@
/*
** Convert a number object to a string, adding it to a buffer
*/
-static size_t tostringbuff (TValue *obj, char *buff) {
- size_t len;
+static int tostringbuff (TValue *obj, char *buff) {
+ int len;
lua_assert(ttisnumber(obj));
if (ttisinteger(obj))
len = lua_integer2str(buff, MAXNUMBER2STR, ivalue(obj));
@@ -387,7 +387,7 @@
*/
void luaO_tostring (lua_State *L, TValue *obj) {
char buff[MAXNUMBER2STR];
- size_t len = tostringbuff(obj, buff);
+ int len = tostringbuff(obj, buff);
setsvalue(L, obj, luaS_newlstr(L, buff, len));
}
@@ -439,11 +439,11 @@
/*
** Get a space of size 'sz' in the buffer. If buffer has not enough
-** space, empty it. 'sz' must fit in an empty space.
+** space, empty it. 'sz' must fit in an empty buffer.
*/
-static char *getbuff (BuffFS *buff, size_t sz) {
+static char *getbuff (BuffFS *buff, int sz) {
lua_assert(buff->blen <= BUFVFS); lua_assert(sz <= BUFVFS);
- if (sz > BUFVFS - cast_sizet(buff->blen)) /* string does not fit? */
+ if (sz > BUFVFS - buff->blen) /* not enough space? */
clearbuff(buff);
return buff->space + buff->blen;
}
@@ -458,9 +458,9 @@
*/
static void addstr2buff (BuffFS *buff, const char *str, size_t slen) {
if (slen <= BUFVFS) { /* does string fit into buffer? */
- char *bf = getbuff(buff, slen);
+ char *bf = getbuff(buff, cast_int(slen));
memcpy(bf, str, slen); /* add string to buffer */
- addsize(buff, slen);
+ addsize(buff, cast_int(slen));
}
else { /* string larger than buffer */
clearbuff(buff); /* string comes after buffer's content */
@@ -474,7 +474,7 @@
*/
static void addnum2buff (BuffFS *buff, TValue *num) {
char *numbuff = getbuff(buff, MAXNUMBER2STR);
- size_t len = tostringbuff(num, numbuff); /* format number into 'numbuff' */
+ int len = tostringbuff(num, numbuff); /* format number into 'numbuff' */
addsize(buff, len);
}
diff --git a/lstring.c b/lstring.c
index c52539a..6ba798d 100644
--- a/lstring.c
+++ b/lstring.c
@@ -121,8 +121,8 @@
int i, j;
for (i = 0; i < STRCACHE_N; i++)
for (j = 0; j < STRCACHE_M; j++) {
- if (iswhite(g->strcache[i][j])) /* will entry be collected? */
- g->strcache[i][j] = g->memerrmsg; /* replace it with something fixed */
+ if (iswhite(g->strcache[i][j])) /* will entry be collected? */
+ g->strcache[i][j] = g->memerrmsg; /* replace it with something fixed */
}
}
diff --git a/ltablib.c b/ltablib.c
index 48a6bdf..7e7a101 100644
--- a/ltablib.c
+++ b/ltablib.c
@@ -306,7 +306,7 @@
}
/* after the loop, a[i] >= P and a[lo .. i - 1] < P */
/* next loop: repeat --j while P < a[j] */
- while (lua_geti(L, 1, --j), sort_comp(L, -3, -1)) {
+ while ((void)lua_geti(L, 1, --j), sort_comp(L, -3, -1)) {
if (j < i) /* j < i but a[j] > P ?? */
luaL_error(L, "invalid order function for sorting");
lua_pop(L, 1); /* remove a[j] */
diff --git a/lvm.c b/lvm.c
index 45788a0..d700079 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1151,7 +1151,7 @@
TValue *rc = vRC(i);
lua_Unsigned n;
if (ttisinteger(rc) /* fast track for integers? */
- ? (n = ivalue(rc), luaV_fastgeti(L, rb, n, slot))
+ ? (cast_void(n = ivalue(rc)), luaV_fastgeti(L, rb, n, slot))
: luaV_fastget(L, rb, rc, slot, luaH_get)) {
setobj2s(L, ra, slot);
}
@@ -1204,7 +1204,7 @@
TValue *rc = RKC(i); /* value */
lua_Unsigned n;
if (ttisinteger(rb) /* fast track for integers? */
- ? (n = ivalue(rb), luaV_fastgeti(L, s2v(ra), n, slot))
+ ? (cast_void(n = ivalue(rb)), luaV_fastgeti(L, s2v(ra), n, slot))
: luaV_fastget(L, s2v(ra), rb, slot, luaH_get)) {
luaV_finishfastset(L, s2v(ra), slot, rc);
}
diff --git a/manual/manual.of b/manual/manual.of
index ff69cd2..687a5b8 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -1504,7 +1504,7 @@
@id{const}, which declares a @x{constant variable},
that is, a variable that cannot be assigned to
after its initialization;
-and @id{toclose}, wich declares a to-be-closed variable @see{to-be-closed}.
+and @id{toclose}, which declares a to-be-closed variable @see{to-be-closed}.
A chunk is also a block @see{chunks},
@@ -1549,7 +1549,7 @@
If a coroutine yields inside a block and is never resumed again,
the variables visible at that block will never go out of scope,
-and therefore they will not be closed.
+and therefore they will never be closed.
Similarly, if a coroutine ends with an error,
it does not unwind its stack,
so it does not close any variable.
@@ -3432,7 +3432,6 @@
its global environment,
but has an independent execution stack.
-There is no explicit function to close or to destroy a thread.
Threads are subject to garbage collection,
like any Lua object.