aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--loslib.c8
-rw-r--r--luaconf.h4
-rw-r--r--lvm.c4
3 files changed, 8 insertions, 8 deletions
diff --git a/loslib.c b/loslib.c
index ff313def..7dce9b26 100644
--- a/loslib.c
+++ b/loslib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: loslib.c,v 1.2 2004/08/05 19:30:37 roberto Exp roberto $ 2** $Id: loslib.c,v 1.3 2004/10/08 18:57:16 roberto Exp roberto $
3** Standard Operating System library 3** Standard Operating System library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -91,15 +91,13 @@ static int io_clock (lua_State *L) {
91*/ 91*/
92 92
93static void setfield (lua_State *L, const char *key, int value) { 93static void setfield (lua_State *L, const char *key, int value) {
94 lua_pushstring(L, key);
95 lua_pushinteger(L, value); 94 lua_pushinteger(L, value);
96 lua_rawset(L, -3); 95 lua_setfield(L, -2, key);
97} 96}
98 97
99static void setboolfield (lua_State *L, const char *key, int value) { 98static void setboolfield (lua_State *L, const char *key, int value) {
100 lua_pushstring(L, key);
101 lua_pushboolean(L, value); 99 lua_pushboolean(L, value);
102 lua_rawset(L, -3); 100 lua_setfield(L, -2, key);
103} 101}
104 102
105static int getboolfield (lua_State *L, const char *key) { 103static int getboolfield (lua_State *L, const char *key) {
diff --git a/luaconf.h b/luaconf.h
index 64747364..d74f1b9d 100644
--- a/luaconf.h
+++ b/luaconf.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: luaconf.h,v 1.25 2005/01/10 16:31:30 roberto Exp roberto $ 2** $Id: luaconf.h,v 1.26 2005/01/10 18:17:39 roberto Exp roberto $
3** Configuration file for Lua 3** Configuration file for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -237,6 +237,8 @@ __inline int l_lrint (double flt)
237/* function to convert a lua_Number to a string */ 237/* function to convert a lua_Number to a string */
238#include <stdio.h> 238#include <stdio.h>
239#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) 239#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n))
240/* maximum size of previous conversion */
241#define MAX_NUMBER2STR 32 /* 16 digits, sign, point and \0 (+ some extra) */
240 242
241/* function to convert a string to a lua_Number */ 243/* function to convert a string to a lua_Number */
242#define lua_str2number(s,p) strtod((s), (p)) 244#define lua_str2number(s,p) strtod((s), (p))
diff --git a/lvm.c b/lvm.c
index 63e0e88d..9592a11a 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lvm.c,v 2.21 2005/01/07 20:00:33 roberto Exp roberto $ 2** $Id: lvm.c,v 2.22 2005/01/10 18:17:39 roberto Exp roberto $
3** Lua virtual machine 3** Lua virtual machine
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -47,7 +47,7 @@ int luaV_tostring (lua_State *L, StkId obj) {
47 if (!ttisnumber(obj)) 47 if (!ttisnumber(obj))
48 return 0; 48 return 0;
49 else { 49 else {
50 char s[32]; /* 16 digits, sign, point and \0 (+ some extra...) */ 50 char s[MAX_NUMBER2STR];
51 lua_number2str(s, nvalue(obj)); 51 lua_number2str(s, nvalue(obj));
52 setsvalue2s(L, obj, luaS_new(L, s)); 52 setsvalue2s(L, obj, luaS_new(L, s));
53 return 1; 53 return 1;