Showing the changes to src (9 of 12 files). Show all
Unified · Split
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: lapi.c,v 2.170 2012/12/05 19:49:55 roberto Exp $ | |
| 2 | +** $Id: lapi.c,v 2.171 2013/03/16 21:10:18 roberto Exp $ | |
| 3 | 3 | ** Lua API |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -1106,7 +1106,7 @@ LUA_API int lua_error (lua_State *L) { · 1100 unmodified lines | ||
| 1106 | 1106 | lua_lock(L); |
| 1107 | 1107 | api_checknelems(L, 1); |
| 1108 | 1108 | luaG_errormsg(L); |
| 1109 | − /* code unreacheable; will unlock when control actually leaves the kernel */ | |
| 1109 | + /* code unreachable; will unlock when control actually leaves the kernel */ | |
| 1110 | 1110 | return 0; /* to avoid warnings */ |
| 1111 | 1111 | } |
| 1112 | 1112 | |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: lauxlib.c,v 1.247 2012/10/19 15:55:01 roberto Exp $ | |
| 2 | +** $Id: lauxlib.c,v 1.248 2013/03/21 13:54:57 roberto Exp $ | |
| 3 | 3 | ** Auxiliary functions for building Lua libraries |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -599,7 +599,7 @@ static int skipBOM (LoadF *lf) { · 593 unmodified lines | ||
| 599 | 599 | lf->n = 0; |
| 600 | 600 | do { |
| 601 | 601 | c = getc(lf->f); |
| 602 | − if (c == EOF || c != *(unsigned char *)p++) return c; | |
| 602 | + if (c == EOF || c != *(const unsigned char *)p++) return c; | |
| 603 | 603 | lf->buff[lf->n++] = c; /* to be read by the parser */ |
| 604 | 604 | } while (*p != '\0'); |
| 605 | 605 | lf->n = 0; /* prefix matched; discard it */ |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: lbitlib.c,v 1.17 2013/02/21 13:44:53 roberto Exp $ | |
| 2 | +** $Id: lbitlib.c,v 1.18 2013/03/19 13:19:12 roberto Exp $ | |
| 3 | 3 | ** Standard library for bitwise operations |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -147,7 +147,9 @@ static int b_rrot (lua_State *L) { · 141 unmodified lines | ||
| 147 | 147 | |
| 148 | 148 | /* |
| 149 | 149 | ** get field and width arguments for field-manipulation functions, |
| 150 | −** checking whether they are valid | |
| 150 | +** checking whether they are valid. | |
| 151 | +** ('luaL_error' called without 'return' to avoid later warnings about | |
| 152 | +** 'width' being used uninitialized.) | |
| 151 | 153 | */ |
| 152 | 154 | static int fieldargs (lua_State *L, int farg, int *width) { |
| 153 | 155 | int f = luaL_checkint(L, farg); |
| @@ -155,7 +157,7 @@ static int fieldargs (lua_State *L, int farg, int *width) { · 1 unmodified line | ||
| 155 | 157 | luaL_argcheck(L, 0 <= f, farg, "field cannot be negative"); |
| 156 | 158 | luaL_argcheck(L, 0 < w, farg + 1, "width must be positive"); |
| 157 | 159 | if (f + w > LUA_NBITS) |
| 158 | − return luaL_error(L, "trying to access non-existent bits"); | |
| 160 | + luaL_error(L, "trying to access non-existent bits"); | |
| 159 | 161 | *width = w; |
| 160 | 162 | return f; |
| 161 | 163 | } |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: lgc.c,v 2.138 2012/10/19 19:00:33 roberto Exp $ | |
| 2 | +** $Id: lgc.c,v 2.140 2013/03/16 21:10:18 roberto Exp $ | |
| 3 | 3 | ** Garbage Collector |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -450,7 +450,7 @@ static lu_mem traversetable (global_State *g, Table *h) { · 444 unmodified lines | ||
| 450 | 450 | else /* not weak */ |
| 451 | 451 | traversestrongtable(g, h); |
| 452 | 452 | return sizeof(Table) + sizeof(TValue) * h->sizearray + |
| 453 | − sizeof(Node) * sizenode(h); | |
| 453 | + sizeof(Node) * cast(size_t, sizenode(h)); | |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | |
| @@ -924,7 +924,7 @@ static void setpause (global_State *g, l_mem estimate) { · 467 unmodified lines | ||
| 924 | 924 | ** object inside the list (instead of to the header), so that the real |
| 925 | 925 | ** sweep do not need to skip objects created between "now" and the start |
| 926 | 926 | ** of the real sweep. |
| 927 | −** Returns how many objects it sweeped. | |
| 927 | +** Returns how many objects it swept. | |
| 928 | 928 | */ |
| 929 | 929 | static int entersweep (lua_State *L) { |
| 930 | 930 | global_State *g = G(L); |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: liolib.c,v 2.108 2011/11/25 12:50:03 roberto Exp $ | |
| 2 | +** $Id: liolib.c,v 2.111 2013/03/21 13:57:27 roberto Exp $ | |
| 3 | 3 | ** Standard I/O (and system) library |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -29,6 +29,20 @@ · 23 unmodified lines | ||
| 29 | 29 | #include "lualib.h" |
| 30 | 30 | |
| 31 | 31 | |
| 32 | +#if !defined(lua_checkmode) | |
| 33 | + | |
| 34 | +/* | |
| 35 | +** Check whether 'mode' matches '[rwa]%+?b?'. | |
| 36 | +** Change this macro to accept other modes for 'fopen' besides | |
| 37 | +** the standard ones. | |
| 38 | +*/ | |
| 39 | +#define lua_checkmode(mode) \ | |
| 40 | + (*mode != '\0' && strchr("rwa", *(mode++)) != NULL && \ | |
| 41 | + (*mode != '+' || ++mode) && /* skip if char is '+' */ \ | |
| 42 | + (*mode != 'b' || ++mode) && /* skip if char is 'b' */ \ | |
| 43 | + (*mode == '\0')) | |
| 44 | + | |
| 45 | +#endif | |
| 32 | 46 | |
| 33 | 47 | /* |
| 34 | 48 | ** {====================================================== |
| @@ -212,14 +226,8 @@ static int io_open (lua_State *L) { · 177 unmodified lines | ||
| 212 | 226 | const char *filename = luaL_checkstring(L, 1); |
| 213 | 227 | const char *mode = luaL_optstring(L, 2, "r"); |
| 214 | 228 | LStream *p = newfile(L); |
| 215 | − int i = 0; | |
| 216 | − /* check whether 'mode' matches '[rwa]%+?b?' */ | |
| 217 | − if (!(mode[i] != '\0' && strchr("rwa", mode[i++]) != NULL && | |
| 218 | − (mode[i] != '+' || ++i) && /* skip if char is '+' */ | |
| 219 | − (mode[i] != 'b' || ++i) && /* skip if char is 'b' */ | |
| 220 | − (mode[i] == '\0'))) | |
| 221 | − return luaL_error(L, "invalid mode " LUA_QS | |
| 222 | − " (should match " LUA_QL("[rwa]%%+?b?") ")", mode); | |
| 229 | + const char *md = mode; /* to traverse/check mode */ | |
| 230 | + luaL_argcheck(L, lua_checkmode(md), 2, "invalid mode"); | |
| 223 | 231 | p->f = fopen(filename, mode); |
| 224 | 232 | return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1; |
| 225 | 233 | } |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: llex.c,v 2.62 2012/12/05 19:57:00 roberto Exp $ | |
| 2 | +** $Id: llex.c,v 2.63 2013/03/16 21:10:18 roberto Exp $ | |
| 3 | 3 | ** Lexical Analyzer |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -313,7 +313,7 @@ static int readhexaesc (LexState *ls) { · 307 unmodified lines | ||
| 313 | 313 | int c[3], i; /* keep input for error message */ |
| 314 | 314 | int r = 0; /* result accumulator */ |
| 315 | 315 | c[0] = 'x'; /* for error message */ |
| 316 | − for (i = 1; i < 3; i++) { /* read two hexa digits */ | |
| 316 | + for (i = 1; i < 3; i++) { /* read two hexadecimal digits */ | |
| 317 | 317 | c[i] = next(ls); |
| 318 | 318 | if (!lisxdigit(c[i])) |
| 319 | 319 | escerror(ls, c, i + 1, "hexadecimal digit expected"); |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: lua.h,v 1.284 2013/02/19 18:39:04 roberto Exp $ | |
| 2 | +** $Id: lua.h,v 1.285 2013/03/15 13:04:22 roberto Exp $ | |
| 3 | 3 | ** Lua - A Scripting Language |
| 4 | 4 | ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) |
| 5 | 5 | ** See Copyright Notice at the end of this file |
| @@ -119,6 +119,11 @@ typedef LUA_UNSIGNED lua_Unsigned; · 113 unmodified lines | ||
| 119 | 119 | #endif |
| 120 | 120 | |
| 121 | 121 | |
| 122 | +/* | |
| 123 | +** RCS ident string | |
| 124 | +*/ | |
| 125 | +extern const char lua_ident[]; | |
| 126 | + | |
| 122 | 127 | |
| 123 | 128 | /* |
| 124 | 129 | ** state manipulation |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: luaconf.h,v 1.175 2013/01/29 16:00:40 roberto Exp $ | |
| 2 | +** $Id: luaconf.h,v 1.176 2013/03/16 21:10:18 roberto Exp $ | |
| 3 | 3 | ** Configuration file for Lua |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -44,7 +44,7 @@ · 38 unmodified lines | ||
| 44 | 44 | #define LUA_USE_POSIX |
| 45 | 45 | #define LUA_USE_DLOPEN /* needs an extra library: -ldl */ |
| 46 | 46 | #define LUA_USE_READLINE /* needs some extra libraries */ |
| 47 | −#define LUA_USE_STRTODHEX /* assume 'strtod' handles hexa formats */ | |
| 47 | +#define LUA_USE_STRTODHEX /* assume 'strtod' handles hex formats */ | |
| 48 | 48 | #define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ |
| 49 | 49 | #define LUA_USE_LONGLONG /* assume support for long long */ |
| 50 | 50 | #endif |
| @@ -53,7 +53,7 @@ · 2 unmodified lines | ||
| 53 | 53 | #define LUA_USE_POSIX |
| 54 | 54 | #define LUA_USE_DLOPEN /* does not need -ldl */ |
| 55 | 55 | #define LUA_USE_READLINE /* needs an extra library: -lreadline */ |
| 56 | −#define LUA_USE_STRTODHEX /* assume 'strtod' handles hexa formats */ | |
| 56 | +#define LUA_USE_STRTODHEX /* assume 'strtod' handles hex formats */ | |
| 57 | 57 | #define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ |
| 58 | 58 | #define LUA_USE_LONGLONG /* assume support for long long */ |
| 59 | 59 | #endif |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: lvm.c,v 2.154 2012/08/16 17:34:28 roberto Exp $ | |
| 2 | +** $Id: lvm.c,v 2.155 2013/03/16 21:10:18 roberto Exp $ | |
| 3 | 3 | ** Lua virtual machine |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -83,7 +83,7 @@ static void traceexec (lua_State *L) { · 77 unmodified lines | ||
| 83 | 83 | if (counthook) |
| 84 | 84 | L->hookcount = 1; /* undo decrement to zero */ |
| 85 | 85 | ci->u.l.savedpc--; /* undo increment (resume will increment it again) */ |
| 86 | − ci->callstatus |= CIST_HOOKYIELD; /* mark that it yieled */ | |
| 86 | + ci->callstatus |= CIST_HOOKYIELD; /* mark that it yielded */ | |
| 87 | 87 | ci->func = L->top - 1; /* protect stack below results */ |
| 88 | 88 | luaD_throw(L, LUA_YIELD); |
| 89 | 89 | } |