summaryrefslogtreecommitdiffhomepage
path: root/libs/nixio/src/fs.c
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2009-11-28 10:24:19 +0000
committerSteven Barth <steven@midlink.org>2009-11-28 10:24:19 +0000
commit87491bf031881a4f5b828aaf6826cf98bda1252e (patch)
treea67086f36d95dbac5ea02f3c06ecf827fa171fbf /libs/nixio/src/fs.c
parent7f9c9d208e2465e80cba92dcc8d450022a8cfd1e (diff)
nixio: Improve number handling with non-double Lua setups
Diffstat (limited to 'libs/nixio/src/fs.c')
-rw-r--r--libs/nixio/src/fs.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/libs/nixio/src/fs.c b/libs/nixio/src/fs.c
index 53a406081..12ca111ac 100644
--- a/libs/nixio/src/fs.c
+++ b/libs/nixio/src/fs.c
@@ -257,8 +257,8 @@ static int nixio_utimes(lua_State *L) {
if (lua_gettop(L) < 2 || (lua_isnoneornil(L, 2) && lua_isnoneornil(L, 3))) {
return nixio__pstatus(L, !utimes(path, NULL));
} else {
- double atime = luaL_checkinteger(L, 2);
- double mtime = luaL_optinteger(L, 3, atime);
+ double atime = nixio__checknumber(L, 2);
+ double mtime = nixio__optnumber(L, 3, atime);
struct timeval times[2];
times[0].tv_sec = atime;
@@ -317,7 +317,7 @@ int nixio__push_stat(lua_State *L, nixio_stat_t *buf) {
lua_pushinteger(L, buf->st_rdev);
lua_setfield(L, -2, "rdev");
- lua_pushinteger(L, buf->st_size);
+ nixio__pushnumber(L, buf->st_size);
lua_setfield(L, -2, "size");
lua_pushinteger(L, buf->st_atime);
@@ -469,37 +469,37 @@ static int nixio_glob(lua_State *L) {
static int nixio__push_statvfs(lua_State *L, struct statvfs *buf) {
lua_createtable(L, 0, 12);
- lua_pushinteger(L, buf->f_bavail);
+ nixio__pushnumber(L, buf->f_bavail);
lua_setfield(L, -2, "bavail");
- lua_pushinteger(L, buf->f_bfree);
+ nixio__pushnumber(L, buf->f_bfree);
lua_setfield(L, -2, "bfree");
- lua_pushinteger(L, buf->f_blocks);
+ nixio__pushnumber(L, buf->f_blocks);
lua_setfield(L, -2, "blocks");
- lua_pushinteger(L, buf->f_bsize);
+ nixio__pushnumber(L, buf->f_bsize);
lua_setfield(L, -2, "bsize");
- lua_pushinteger(L, buf->f_frsize);
+ nixio__pushnumber(L, buf->f_frsize);
lua_setfield(L, -2, "frsize");
- lua_pushinteger(L, buf->f_favail);
+ nixio__pushnumber(L, buf->f_favail);
lua_setfield(L, -2, "favail");
- lua_pushinteger(L, buf->f_ffree);
+ nixio__pushnumber(L, buf->f_ffree);
lua_setfield(L, -2, "ffree");
- lua_pushinteger(L, buf->f_files);
+ nixio__pushnumber(L, buf->f_files);
lua_setfield(L, -2, "files");
- lua_pushinteger(L, buf->f_flag);
+ nixio__pushnumber(L, buf->f_flag);
lua_setfield(L, -2, "flag");
- lua_pushinteger(L, buf->f_fsid);
+ nixio__pushnumber(L, buf->f_fsid);
lua_setfield(L, -2, "fsid");
- lua_pushinteger(L, buf->f_namemax);
+ nixio__pushnumber(L, buf->f_namemax);
lua_setfield(L, -2, "namemax");
return 1;