aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2006-01-18 09:49:12 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2006-01-18 09:49:12 -0200
commitbaffc37f5c8d15c03da0ce689bdecadc1219fe99 (patch)
treee49318b4c37647d5d1b5dbfd857b01d7d94d44c3
parent440113bbe8c44b160e11ee47f9b3b322ed1441fb (diff)
downloadlua-baffc37f5c8d15c03da0ce689bdecadc1219fe99.tar.gz
lua-baffc37f5c8d15c03da0ce689bdecadc1219fe99.tar.bz2
lua-baffc37f5c8d15c03da0ce689bdecadc1219fe99.zip
detail
-rw-r--r--lbaselib.c4
-rw-r--r--liolib.c9
-rw-r--r--ltable.c4
3 files changed, 9 insertions, 8 deletions
diff --git a/lbaselib.c b/lbaselib.c
index 8529414d..39e498de 100644
--- a/lbaselib.c
+++ b/lbaselib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lbaselib.c,v 1.187 2005/12/27 17:10:11 roberto Exp roberto $ 2** $Id: lbaselib.c,v 1.188 2005/12/29 15:32:11 roberto Exp roberto $
3** Basic library 3** Basic library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -201,7 +201,7 @@ static int luaB_collectgarbage (lua_State *L) {
201 switch (optsnum[o]) { 201 switch (optsnum[o]) {
202 case LUA_GCCOUNT: { 202 case LUA_GCCOUNT: {
203 int b = lua_gc(L, LUA_GCCOUNTB, 0); 203 int b = lua_gc(L, LUA_GCCOUNTB, 0);
204 lua_pushnumber(L, ((lua_Number)res*1024 + b)/1024); 204 lua_pushnumber(L, res + ((lua_Number)b/1024));
205 return 1; 205 return 1;
206 } 206 }
207 case LUA_GCSTEP: { 207 case LUA_GCSTEP: {
diff --git a/liolib.c b/liolib.c
index fc059e2e..f55f7a63 100644
--- a/liolib.c
+++ b/liolib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: liolib.c,v 2.69 2005/10/19 13:05:11 roberto Exp roberto $ 2** $Id: liolib.c,v 2.70 2005/12/29 15:32:11 roberto Exp roberto $
3** Standard I/O (and system) library 3** Standard I/O (and system) library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -28,6 +28,7 @@ static const char *const fnames[] = {"input", "output"};
28 28
29 29
30static int pushresult (lua_State *L, int i, const char *filename) { 30static int pushresult (lua_State *L, int i, const char *filename) {
31 int en = errno; /* calls to Lua API may change this value */
31 if (i) { 32 if (i) {
32 lua_pushboolean(L, 1); 33 lua_pushboolean(L, 1);
33 return 1; 34 return 1;
@@ -35,10 +36,10 @@ static int pushresult (lua_State *L, int i, const char *filename) {
35 else { 36 else {
36 lua_pushnil(L); 37 lua_pushnil(L);
37 if (filename) 38 if (filename)
38 lua_pushfstring(L, "%s: %s", filename, strerror(errno)); 39 lua_pushfstring(L, "%s: %s", filename, strerror(en));
39 else 40 else
40 lua_pushfstring(L, "%s", strerror(errno)); 41 lua_pushfstring(L, "%s", strerror(en));
41 lua_pushinteger(L, errno); 42 lua_pushinteger(L, en);
42 return 3; 43 return 3;
43 } 44 }
44} 45}
diff --git a/ltable.c b/ltable.c
index 0e80237c..b68d1486 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.c,v 2.30 2006/01/10 12:51:53 roberto Exp roberto $ 2** $Id: ltable.c,v 2.31 2006/01/10 13:13:06 roberto Exp roberto $
3** Lua tables (hash) 3** Lua tables (hash)
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -122,7 +122,7 @@ static int arrayindex (const TValue *key) {
122 lua_Number n = nvalue(key); 122 lua_Number n = nvalue(key);
123 int k; 123 int k;
124 lua_number2int(k, n); 124 lua_number2int(k, n);
125 if (luai_numeq(cast_num(k), nvalue(key))) 125 if (luai_numeq(cast_num(k), n))
126 return k; 126 return k;
127 } 127 }
128 return -1; /* `key' did not match some condition */ 128 return -1; /* `key' did not match some condition */