diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-07-31 14:12:32 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-07-31 14:12:32 -0300 |
| commit | 1a343814d8da9f9c2067d6ca3d82d57c84f91f10 (patch) | |
| tree | c451a4dd76355900999026c90fac3cd6f0b71385 | |
| parent | 280f7becb86fccd14122964341b4556754c31b3b (diff) | |
| download | lua-1a343814d8da9f9c2067d6ca3d82d57c84f91f10.tar.gz lua-1a343814d8da9f9c2067d6ca3d82d57c84f91f10.tar.bz2 lua-1a343814d8da9f9c2067d6ca3d82d57c84f91f10.zip | |
details
| -rw-r--r-- | lapi.c | 10 | ||||
| -rw-r--r-- | lobject.c | 7 |
2 files changed, 8 insertions, 9 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 2.44 2005/07/05 14:30:31 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.45 2005/07/06 18:07:30 roberto Exp roberto $ |
| 3 | ** Lua API | 3 | ** Lua API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -113,11 +113,11 @@ LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) { | |||
| 113 | if (from == to) return; | 113 | if (from == to) return; |
| 114 | lua_lock(to); | 114 | lua_lock(to); |
| 115 | api_checknelems(from, n); | 115 | api_checknelems(from, n); |
| 116 | api_check(L, G(from) == G(to)); | 116 | api_check(from, G(from) == G(to)); |
| 117 | api_check(from, to->ci->top - to->top >= n); | ||
| 117 | from->top -= n; | 118 | from->top -= n; |
| 118 | for (i = 0; i < n; i++) { | 119 | for (i = 0; i < n; i++) { |
| 119 | setobj2s(to, to->top, from->top + i); | 120 | setobj2s(to, to->top++, from->top + i); |
| 120 | api_incr_top(to); | ||
| 121 | } | 121 | } |
| 122 | lua_unlock(to); | 122 | lua_unlock(to); |
| 123 | } | 123 | } |
| @@ -975,9 +975,9 @@ LUA_API int lua_next (lua_State *L, int idx) { | |||
| 975 | 975 | ||
| 976 | LUA_API void lua_concat (lua_State *L, int n) { | 976 | LUA_API void lua_concat (lua_State *L, int n) { |
| 977 | lua_lock(L); | 977 | lua_lock(L); |
| 978 | luaC_checkGC(L); | ||
| 979 | api_checknelems(L, n); | 978 | api_checknelems(L, n); |
| 980 | if (n >= 2) { | 979 | if (n >= 2) { |
| 980 | luaC_checkGC(L); | ||
| 981 | luaV_concat(L, n, cast(int, L->top - L->base) - 1); | 981 | luaV_concat(L, n, cast(int, L->top - L->base) - 1); |
| 982 | L->top -= (n-1); | 982 | L->top -= (n-1); |
| 983 | } | 983 | } |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lobject.c,v 2.15 2005/05/31 14:25:18 roberto Exp roberto $ | 2 | ** $Id: lobject.c,v 2.16 2005/07/11 14:00:14 roberto Exp roberto $ |
| 3 | ** Some generic functions over Lua objects | 3 | ** Some generic functions over Lua objects |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -89,11 +89,10 @@ int luaO_rawequalObj (const TValue *t1, const TValue *t2) { | |||
| 89 | 89 | ||
| 90 | int luaO_str2d (const char *s, lua_Number *result) { | 90 | int luaO_str2d (const char *s, lua_Number *result) { |
| 91 | char *endptr; | 91 | char *endptr; |
| 92 | lua_Number res = lua_str2number(s, &endptr); | 92 | *result = lua_str2number(s, &endptr); |
| 93 | if (endptr == s) return 0; /* no conversion */ | 93 | if (endptr == s) return 0; /* conversion failed */ |
| 94 | while (isspace(cast(unsigned char, *endptr))) endptr++; | 94 | while (isspace(cast(unsigned char, *endptr))) endptr++; |
| 95 | if (*endptr != '\0') return 0; /* invalid trailing characters? */ | 95 | if (*endptr != '\0') return 0; /* invalid trailing characters? */ |
| 96 | *result = res; | ||
| 97 | return 1; | 96 | return 1; |
| 98 | } | 97 | } |
| 99 | 98 | ||
