mirror of
https://github.com/lua/lua.git
synced 2024-11-23 18:23:43 +08:00
details (typos in comments)
This commit is contained in:
parent
f96872a534
commit
da4811238a
4
lcode.c
4
lcode.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lcode.c,v 2.83 2014/03/07 16:19:00 roberto Exp roberto $
|
||||
** $Id: lcode.c,v 2.84 2014/03/09 19:21:34 roberto Exp roberto $
|
||||
** Code generator for Lua
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -308,7 +308,7 @@ static void freeexp (FuncState *fs, expdesc *e) {
|
||||
|
||||
|
||||
/*
|
||||
** Use scanner's table to cache position of constants in contant list
|
||||
** Use scanner's table to cache position of constants in constant list
|
||||
** and try to reuse constants
|
||||
*/
|
||||
static int addk (FuncState *fs, TValue *key, TValue *v) {
|
||||
|
4
ldo.c
4
ldo.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: ldo.c,v 2.113 2014/02/15 13:12:01 roberto Exp roberto $
|
||||
** $Id: ldo.c,v 2.114 2014/02/26 15:27:56 roberto Exp roberto $
|
||||
** Stack and Call structure of Lua
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -58,7 +58,7 @@
|
||||
|
||||
#elif defined(LUA_USE_POSIX) /* }{ */
|
||||
|
||||
/* in Posix, try _longjmp/_setjmp (more efficient) */
|
||||
/* in POSIX, try _longjmp/_setjmp (more efficient) */
|
||||
#define LUAI_THROW(L,c) _longjmp((c)->b, 1)
|
||||
#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a }
|
||||
#define luai_jmpbuf jmp_buf
|
||||
|
4
lgc.c
4
lgc.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lgc.c,v 2.177 2014/02/18 13:46:26 roberto Exp roberto $
|
||||
** $Id: lgc.c,v 2.178 2014/02/19 13:51:09 roberto Exp roberto $
|
||||
** Garbage Collector
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -169,7 +169,7 @@ void luaC_barrierback_ (lua_State *L, GCObject *o) {
|
||||
/*
|
||||
** barrier for assignments to closed upvalues. Because upvalues are
|
||||
** shared among closures, it is impossible to know the color of all
|
||||
** closured pointing to it. So, we assume that the object being assigned
|
||||
** closures pointing to it. So, we assume that the object being assigned
|
||||
** must be marked.
|
||||
*/
|
||||
LUAI_FUNC void luaC_upvalbarrier_ (lua_State *L, UpVal *uv) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lobject.c,v 2.74 2014/02/26 15:27:56 roberto Exp roberto $
|
||||
** $Id: lobject.c,v 2.75 2014/03/06 16:15:18 roberto Exp roberto $
|
||||
** Some generic functions over Lua objects
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -140,7 +140,7 @@ void luaO_arith (lua_State *L, int op, const TValue *p1, const TValue *p2,
|
||||
else break; /* go to the end */
|
||||
}
|
||||
}
|
||||
/* could not perform raw operation; try metmethod */
|
||||
/* could not perform raw operation; try metamethod */
|
||||
lua_assert(L != NULL); /* should not fail when folding (compile time) */
|
||||
luaT_trybinTM(L, p1, p2, res, cast(TMS, op - LUA_OPADD + TM_ADD));
|
||||
}
|
||||
|
16
lstrlib.c
16
lstrlib.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lstrlib.c,v 1.186 2014/02/25 14:30:21 roberto Exp roberto $
|
||||
** $Id: lstrlib.c,v 1.187 2014/03/12 18:09:06 roberto Exp roberto $
|
||||
** Standard library for string operations and pattern-matching
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -1005,7 +1005,7 @@ static int packint (char *buff, lua_Integer n, int littleendian, int size) {
|
||||
}
|
||||
buff[i] = (n & MC); /* last byte */
|
||||
/* test for overflow: OK if there are only zeros left in higher bytes,
|
||||
or if there are only oneś left and packed number is negative (signal
|
||||
or if there are only ones left and packed number is negative (signal
|
||||
bit, the higher bit in last byte, is one) */
|
||||
return ((n & ~MC) == 0 || (n | SM) == ~(lua_Integer)0);
|
||||
}
|
||||
@ -1027,7 +1027,7 @@ static int packint_l (lua_State *L) {
|
||||
/* mask to check higher-order byte in a Lua integer */
|
||||
#define HIGHERBYTE (MC << (NB * (SZINT - 1)))
|
||||
|
||||
/* mask to check higher-order byte + signal bit of next byte */
|
||||
/* mask to check higher-order byte + signal bit of next (lower) byte */
|
||||
#define HIGHERBYTE1 (HIGHERBYTE | (HIGHERBYTE >> 1))
|
||||
|
||||
static int unpackint (const char *buff, lua_Integer *res,
|
||||
@ -1037,12 +1037,12 @@ static int unpackint (const char *buff, lua_Integer *res,
|
||||
for (i = 0; i < size; i++) {
|
||||
if (i >= SZINT) { /* will throw away a byte? */
|
||||
/* check for overflow: it is OK to throw away leading zeros for a
|
||||
positive number; leading ones for a negative number; and one
|
||||
last leading zero to allow unsigned integers with a 1 in
|
||||
positive number, leading ones for a negative number, and a
|
||||
leading zero byte to allow unsigned integers with a 1 in
|
||||
its "signal bit" */
|
||||
if (!((n & HIGHERBYTE1) == 0 || /* zeros for pos. number */
|
||||
(n & HIGHERBYTE1) == HIGHERBYTE1 || /* ones for neg. number */
|
||||
((n & HIGHERBYTE) == 0 && i == size - 1))) /* last zero */
|
||||
if (!((n & HIGHERBYTE1) == 0 || /* zeros for positive number */
|
||||
(n & HIGHERBYTE1) == HIGHERBYTE1 || /* ones for negative number */
|
||||
((n & HIGHERBYTE) == 0 && i == size - 1))) /* leading zero */
|
||||
return 0; /* overflow */
|
||||
}
|
||||
n <<= NB;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: ltablib.c,v 1.64 2013/02/06 18:29:03 roberto Exp roberto $
|
||||
** $Id: ltablib.c,v 1.65 2013/03/07 18:17:24 roberto Exp roberto $
|
||||
** Library for Table Manipulation
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -140,7 +140,7 @@ static int unpack (lua_State *L) {
|
||||
e = luaL_opt(L, luaL_checkint, 3, luaL_len(L, 1));
|
||||
if (i > e) return 0; /* empty range */
|
||||
n = e - i + 1; /* number of elements */
|
||||
if (n <= 0 || !lua_checkstack(L, n)) /* n <= 0 means arith. overflow */
|
||||
if (n <= 0 || !lua_checkstack(L, n)) /* n <= 0 means arithmetic overflow */
|
||||
return luaL_error(L, "too many results to unpack");
|
||||
lua_rawgeti(L, 1, i); /* push arg[i] (avoiding overflow problems) */
|
||||
while (i++ < e) /* push arg[i + 1...e] */
|
||||
|
Loading…
Reference in New Issue
Block a user