diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-06-03 11:36:42 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-06-03 11:36:42 -0300 |
| commit | 2c68e66570206aa1496f9c76fcf2a1a0f550d692 (patch) | |
| tree | bcc6fd7939b12ef3a636d88ce0ac38da036660d8 | |
| parent | 7d0f41df41e9c513e7282356541b54beaf9ed20d (diff) | |
| download | lua-2c68e66570206aa1496f9c76fcf2a1a0f550d692.tar.gz lua-2c68e66570206aa1496f9c76fcf2a1a0f550d692.tar.bz2 lua-2c68e66570206aa1496f9c76fcf2a1a0f550d692.zip | |
Details
Several small changes from feedback on 5.4 alhpa rc1 (warnings,
typos in the manual, and the like)
Diffstat (limited to '')
| -rw-r--r-- | ldebug.c | 5 | ||||
| -rw-r--r-- | lgc.c | 4 | ||||
| -rw-r--r-- | llex.c | 4 | ||||
| -rw-r--r-- | lobject.c | 18 | ||||
| -rw-r--r-- | lstring.c | 4 | ||||
| -rw-r--r-- | ltablib.c | 2 | ||||
| -rw-r--r-- | lvm.c | 4 | ||||
| -rw-r--r-- | manual/manual.of | 5 |
8 files changed, 23 insertions, 23 deletions
| @@ -373,6 +373,7 @@ static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, | |||
| 373 | ar->ftransfer = ci->u2.transferinfo.ftransfer; | 373 | ar->ftransfer = ci->u2.transferinfo.ftransfer; |
| 374 | ar->ntransfer = ci->u2.transferinfo.ntransfer; | 374 | ar->ntransfer = ci->u2.transferinfo.ntransfer; |
| 375 | } | 375 | } |
| 376 | break; | ||
| 376 | } | 377 | } |
| 377 | case 'L': | 378 | case 'L': |
| 378 | case 'f': /* handled by lua_getinfo */ | 379 | case 'f': /* handled by lua_getinfo */ |
| @@ -525,8 +526,8 @@ static const char *gxf (const Proto *p, int pc, Instruction i, int isup) { | |||
| 525 | } | 526 | } |
| 526 | 527 | ||
| 527 | 528 | ||
| 528 | const char *getobjname (const Proto *p, int lastpc, int reg, | 529 | static const char *getobjname (const Proto *p, int lastpc, int reg, |
| 529 | const char **name) { | 530 | const char **name) { |
| 530 | int pc; | 531 | int pc; |
| 531 | *name = luaF_getlocalname(p, reg + 1, lastpc); | 532 | *name = luaF_getlocalname(p, reg + 1, lastpc); |
| 532 | if (*name) /* is a local? */ | 533 | if (*name) /* is a local? */ |
| @@ -484,8 +484,8 @@ static lu_mem traversetable (global_State *g, Table *h) { | |||
| 484 | const TValue *mode = gfasttm(g, h->metatable, TM_MODE); | 484 | const TValue *mode = gfasttm(g, h->metatable, TM_MODE); |
| 485 | markobjectN(g, h->metatable); | 485 | markobjectN(g, h->metatable); |
| 486 | if (mode && ttisstring(mode) && /* is there a weak mode? */ | 486 | if (mode && ttisstring(mode) && /* is there a weak mode? */ |
| 487 | ((weakkey = strchr(svalue(mode), 'k')), | 487 | (cast_void(weakkey = strchr(svalue(mode), 'k')), |
| 488 | (weakvalue = strchr(svalue(mode), 'v')), | 488 | cast_void(weakvalue = strchr(svalue(mode), 'v')), |
| 489 | (weakkey || weakvalue))) { /* is really weak? */ | 489 | (weakkey || weakvalue))) { /* is really weak? */ |
| 490 | black2gray(h); /* keep table gray */ | 490 | black2gray(h); /* keep table gray */ |
| 491 | if (!weakkey) /* strong keys? */ | 491 | if (!weakkey) /* strong keys? */ |
| @@ -29,7 +29,7 @@ | |||
| 29 | 29 | ||
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | #define next(ls) (ls->current = zgetc(ls->z)) | 32 | #define next(ls) (ls->current = zgetc(ls->z)) |
| 33 | 33 | ||
| 34 | 34 | ||
| 35 | 35 | ||
| @@ -337,7 +337,7 @@ static unsigned long readutf8esc (LexState *ls) { | |||
| 337 | save_and_next(ls); /* skip 'u' */ | 337 | save_and_next(ls); /* skip 'u' */ |
| 338 | esccheck(ls, ls->current == '{', "missing '{'"); | 338 | esccheck(ls, ls->current == '{', "missing '{'"); |
| 339 | r = gethexa(ls); /* must have at least one digit */ | 339 | r = gethexa(ls); /* must have at least one digit */ |
| 340 | while ((save_and_next(ls), lisxdigit(ls->current))) { | 340 | while (cast_void(save_and_next(ls)), lisxdigit(ls->current)) { |
| 341 | i++; | 341 | i++; |
| 342 | esccheck(ls, r <= (0x7FFFFFFFu >> 4), "UTF-8 value too large"); | 342 | esccheck(ls, r <= (0x7FFFFFFFu >> 4), "UTF-8 value too large"); |
| 343 | r = (r << 4) + luaO_hexavalue(ls->current); | 343 | r = (r << 4) + luaO_hexavalue(ls->current); |
| @@ -366,8 +366,8 @@ int luaO_utf8esc (char *buff, unsigned long x) { | |||
| 366 | /* | 366 | /* |
| 367 | ** Convert a number object to a string, adding it to a buffer | 367 | ** Convert a number object to a string, adding it to a buffer |
| 368 | */ | 368 | */ |
| 369 | static size_t tostringbuff (TValue *obj, char *buff) { | 369 | static int tostringbuff (TValue *obj, char *buff) { |
| 370 | size_t len; | 370 | int len; |
| 371 | lua_assert(ttisnumber(obj)); | 371 | lua_assert(ttisnumber(obj)); |
| 372 | if (ttisinteger(obj)) | 372 | if (ttisinteger(obj)) |
| 373 | len = lua_integer2str(buff, MAXNUMBER2STR, ivalue(obj)); | 373 | len = lua_integer2str(buff, MAXNUMBER2STR, ivalue(obj)); |
| @@ -387,7 +387,7 @@ static size_t tostringbuff (TValue *obj, char *buff) { | |||
| 387 | */ | 387 | */ |
| 388 | void luaO_tostring (lua_State *L, TValue *obj) { | 388 | void luaO_tostring (lua_State *L, TValue *obj) { |
| 389 | char buff[MAXNUMBER2STR]; | 389 | char buff[MAXNUMBER2STR]; |
| 390 | size_t len = tostringbuff(obj, buff); | 390 | int len = tostringbuff(obj, buff); |
| 391 | setsvalue(L, obj, luaS_newlstr(L, buff, len)); | 391 | setsvalue(L, obj, luaS_newlstr(L, buff, len)); |
| 392 | } | 392 | } |
| 393 | 393 | ||
| @@ -439,11 +439,11 @@ static void clearbuff (BuffFS *buff) { | |||
| 439 | 439 | ||
| 440 | /* | 440 | /* |
| 441 | ** Get a space of size 'sz' in the buffer. If buffer has not enough | 441 | ** Get a space of size 'sz' in the buffer. If buffer has not enough |
| 442 | ** space, empty it. 'sz' must fit in an empty space. | 442 | ** space, empty it. 'sz' must fit in an empty buffer. |
| 443 | */ | 443 | */ |
| 444 | static char *getbuff (BuffFS *buff, size_t sz) { | 444 | static char *getbuff (BuffFS *buff, int sz) { |
| 445 | lua_assert(buff->blen <= BUFVFS); lua_assert(sz <= BUFVFS); | 445 | lua_assert(buff->blen <= BUFVFS); lua_assert(sz <= BUFVFS); |
| 446 | if (sz > BUFVFS - cast_sizet(buff->blen)) /* string does not fit? */ | 446 | if (sz > BUFVFS - buff->blen) /* not enough space? */ |
| 447 | clearbuff(buff); | 447 | clearbuff(buff); |
| 448 | return buff->space + buff->blen; | 448 | return buff->space + buff->blen; |
| 449 | } | 449 | } |
| @@ -458,9 +458,9 @@ static char *getbuff (BuffFS *buff, size_t sz) { | |||
| 458 | */ | 458 | */ |
| 459 | static void addstr2buff (BuffFS *buff, const char *str, size_t slen) { | 459 | static void addstr2buff (BuffFS *buff, const char *str, size_t slen) { |
| 460 | if (slen <= BUFVFS) { /* does string fit into buffer? */ | 460 | if (slen <= BUFVFS) { /* does string fit into buffer? */ |
| 461 | char *bf = getbuff(buff, slen); | 461 | char *bf = getbuff(buff, cast_int(slen)); |
| 462 | memcpy(bf, str, slen); /* add string to buffer */ | 462 | memcpy(bf, str, slen); /* add string to buffer */ |
| 463 | addsize(buff, slen); | 463 | addsize(buff, cast_int(slen)); |
| 464 | } | 464 | } |
| 465 | else { /* string larger than buffer */ | 465 | else { /* string larger than buffer */ |
| 466 | clearbuff(buff); /* string comes after buffer's content */ | 466 | clearbuff(buff); /* string comes after buffer's content */ |
| @@ -474,7 +474,7 @@ static void addstr2buff (BuffFS *buff, const char *str, size_t slen) { | |||
| 474 | */ | 474 | */ |
| 475 | static void addnum2buff (BuffFS *buff, TValue *num) { | 475 | static void addnum2buff (BuffFS *buff, TValue *num) { |
| 476 | char *numbuff = getbuff(buff, MAXNUMBER2STR); | 476 | char *numbuff = getbuff(buff, MAXNUMBER2STR); |
| 477 | size_t len = tostringbuff(num, numbuff); /* format number into 'numbuff' */ | 477 | int len = tostringbuff(num, numbuff); /* format number into 'numbuff' */ |
| 478 | addsize(buff, len); | 478 | addsize(buff, len); |
| 479 | } | 479 | } |
| 480 | 480 | ||
| @@ -121,8 +121,8 @@ void luaS_clearcache (global_State *g) { | |||
| 121 | int i, j; | 121 | int i, j; |
| 122 | for (i = 0; i < STRCACHE_N; i++) | 122 | for (i = 0; i < STRCACHE_N; i++) |
| 123 | for (j = 0; j < STRCACHE_M; j++) { | 123 | for (j = 0; j < STRCACHE_M; j++) { |
| 124 | if (iswhite(g->strcache[i][j])) /* will entry be collected? */ | 124 | if (iswhite(g->strcache[i][j])) /* will entry be collected? */ |
| 125 | g->strcache[i][j] = g->memerrmsg; /* replace it with something fixed */ | 125 | g->strcache[i][j] = g->memerrmsg; /* replace it with something fixed */ |
| 126 | } | 126 | } |
| 127 | } | 127 | } |
| 128 | 128 | ||
| @@ -306,7 +306,7 @@ static IdxT partition (lua_State *L, IdxT lo, IdxT up) { | |||
| 306 | } | 306 | } |
| 307 | /* after the loop, a[i] >= P and a[lo .. i - 1] < P */ | 307 | /* after the loop, a[i] >= P and a[lo .. i - 1] < P */ |
| 308 | /* next loop: repeat --j while P < a[j] */ | 308 | /* next loop: repeat --j while P < a[j] */ |
| 309 | while (lua_geti(L, 1, --j), sort_comp(L, -3, -1)) { | 309 | while ((void)lua_geti(L, 1, --j), sort_comp(L, -3, -1)) { |
| 310 | if (j < i) /* j < i but a[j] > P ?? */ | 310 | if (j < i) /* j < i but a[j] > P ?? */ |
| 311 | luaL_error(L, "invalid order function for sorting"); | 311 | luaL_error(L, "invalid order function for sorting"); |
| 312 | lua_pop(L, 1); /* remove a[j] */ | 312 | lua_pop(L, 1); /* remove a[j] */ |
| @@ -1151,7 +1151,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1151 | TValue *rc = vRC(i); | 1151 | TValue *rc = vRC(i); |
| 1152 | lua_Unsigned n; | 1152 | lua_Unsigned n; |
| 1153 | if (ttisinteger(rc) /* fast track for integers? */ | 1153 | if (ttisinteger(rc) /* fast track for integers? */ |
| 1154 | ? (n = ivalue(rc), luaV_fastgeti(L, rb, n, slot)) | 1154 | ? (cast_void(n = ivalue(rc)), luaV_fastgeti(L, rb, n, slot)) |
| 1155 | : luaV_fastget(L, rb, rc, slot, luaH_get)) { | 1155 | : luaV_fastget(L, rb, rc, slot, luaH_get)) { |
| 1156 | setobj2s(L, ra, slot); | 1156 | setobj2s(L, ra, slot); |
| 1157 | } | 1157 | } |
| @@ -1204,7 +1204,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1204 | TValue *rc = RKC(i); /* value */ | 1204 | TValue *rc = RKC(i); /* value */ |
| 1205 | lua_Unsigned n; | 1205 | lua_Unsigned n; |
| 1206 | if (ttisinteger(rb) /* fast track for integers? */ | 1206 | if (ttisinteger(rb) /* fast track for integers? */ |
| 1207 | ? (n = ivalue(rb), luaV_fastgeti(L, s2v(ra), n, slot)) | 1207 | ? (cast_void(n = ivalue(rb)), luaV_fastgeti(L, s2v(ra), n, slot)) |
| 1208 | : luaV_fastget(L, s2v(ra), rb, slot, luaH_get)) { | 1208 | : luaV_fastget(L, s2v(ra), rb, slot, luaH_get)) { |
| 1209 | luaV_finishfastset(L, s2v(ra), slot, rc); | 1209 | luaV_finishfastset(L, s2v(ra), slot, rc); |
| 1210 | } | 1210 | } |
diff --git a/manual/manual.of b/manual/manual.of index ff69cd2c..687a5b89 100644 --- a/manual/manual.of +++ b/manual/manual.of | |||
| @@ -1504,7 +1504,7 @@ There are two possible attributes: | |||
| 1504 | @id{const}, which declares a @x{constant variable}, | 1504 | @id{const}, which declares a @x{constant variable}, |
| 1505 | that is, a variable that cannot be assigned to | 1505 | that is, a variable that cannot be assigned to |
| 1506 | after its initialization; | 1506 | after its initialization; |
| 1507 | and @id{toclose}, wich declares a to-be-closed variable @see{to-be-closed}. | 1507 | and @id{toclose}, which declares a to-be-closed variable @see{to-be-closed}. |
| 1508 | 1508 | ||
| 1509 | 1509 | ||
| 1510 | A chunk is also a block @see{chunks}, | 1510 | A chunk is also a block @see{chunks}, |
| @@ -1549,7 +1549,7 @@ the other pending closing methods will still be called. | |||
| 1549 | 1549 | ||
| 1550 | If a coroutine yields inside a block and is never resumed again, | 1550 | If a coroutine yields inside a block and is never resumed again, |
| 1551 | the variables visible at that block will never go out of scope, | 1551 | the variables visible at that block will never go out of scope, |
| 1552 | and therefore they will not be closed. | 1552 | and therefore they will never be closed. |
| 1553 | Similarly, if a coroutine ends with an error, | 1553 | Similarly, if a coroutine ends with an error, |
| 1554 | it does not unwind its stack, | 1554 | it does not unwind its stack, |
| 1555 | so it does not close any variable. | 1555 | so it does not close any variable. |
| @@ -3432,7 +3432,6 @@ The new thread returned by this function shares with the original thread | |||
| 3432 | its global environment, | 3432 | its global environment, |
| 3433 | but has an independent execution stack. | 3433 | but has an independent execution stack. |
| 3434 | 3434 | ||
| 3435 | There is no explicit function to close or to destroy a thread. | ||
| 3436 | Threads are subject to garbage collection, | 3435 | Threads are subject to garbage collection, |
| 3437 | like any Lua object. | 3436 | like any Lua object. |
| 3438 | 3437 | ||
