commit 1a343814d8da9f9c2067d6ca3d82d57c84f91f10
parent 280f7becb86fccd14122964341b4556754c31b3b
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Sun, 31 Jul 2005 14:12:10 -0300
details
Diffstat:
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/lapi.c b/lapi.c
@@ -1,5 +1,5 @@
/*
-** $Id: lapi.c,v 2.44 2005/07/05 14:30:31 roberto Exp roberto $
+** $Id: lapi.c,v 2.45 2005/07/06 18:07:30 roberto Exp roberto $
** Lua API
** See Copyright Notice in lua.h
*/
@@ -113,11 +113,11 @@ LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) {
if (from == to) return;
lua_lock(to);
api_checknelems(from, n);
- api_check(L, G(from) == G(to));
+ api_check(from, G(from) == G(to));
+ api_check(from, to->ci->top - to->top >= n);
from->top -= n;
for (i = 0; i < n; i++) {
- setobj2s(to, to->top, from->top + i);
- api_incr_top(to);
+ setobj2s(to, to->top++, from->top + i);
}
lua_unlock(to);
}
@@ -975,9 +975,9 @@ LUA_API int lua_next (lua_State *L, int idx) {
LUA_API void lua_concat (lua_State *L, int n) {
lua_lock(L);
- luaC_checkGC(L);
api_checknelems(L, n);
if (n >= 2) {
+ luaC_checkGC(L);
luaV_concat(L, n, cast(int, L->top - L->base) - 1);
L->top -= (n-1);
}
diff --git a/lobject.c b/lobject.c
@@ -1,5 +1,5 @@
/*
-** $Id: lobject.c,v 2.15 2005/05/31 14:25:18 roberto Exp roberto $
+** $Id: lobject.c,v 2.16 2005/07/11 14:00:14 roberto Exp roberto $
** Some generic functions over Lua objects
** See Copyright Notice in lua.h
*/
@@ -89,11 +89,10 @@ int luaO_rawequalObj (const TValue *t1, const TValue *t2) {
int luaO_str2d (const char *s, lua_Number *result) {
char *endptr;
- lua_Number res = lua_str2number(s, &endptr);
- if (endptr == s) return 0; /* no conversion */
+ *result = lua_str2number(s, &endptr);
+ if (endptr == s) return 0; /* conversion failed */
while (isspace(cast(unsigned char, *endptr))) endptr++;
if (*endptr != '\0') return 0; /* invalid trailing characters? */
- *result = res;
return 1;
}