aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Melnichenko <mpeterval@gmail.com>2016-04-25 15:42:54 +0300
committerPeter Melnichenko <mpeterval@gmail.com>2016-04-25 15:42:54 +0300
commitc1e9c70214f9731b32a9ed713963e0326d167aa0 (patch)
tree46bfa6187365171f765e8ed266d048167d580ae0
parent655ec8baa3e1e2c3f0fc13845f9b3f86416ec944 (diff)
downloadluafilesystem-c1e9c70214f9731b32a9ed713963e0326d167aa0.tar.gz
luafilesystem-c1e9c70214f9731b32a9ed713963e0326d167aa0.tar.bz2
luafilesystem-c1e9c70214f9731b32a9ed713963e0326d167aa0.zip
Don't pass Lua state to lfs_setmode, it's always unused
-rw-r--r--src/lfs.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lfs.c b/src/lfs.c
index df7ec2c..fb8099f 100644
--- a/src/lfs.c
+++ b/src/lfs.c
@@ -117,10 +117,10 @@ typedef struct dir_data {
117 117
118#ifdef _WIN32 118#ifdef _WIN32
119 #ifdef __BORLANDC__ 119 #ifdef __BORLANDC__
120 #define lfs_setmode(L,file,m) ((void)L, setmode(_fileno(file), m)) 120 #define lfs_setmode(file, m) (setmode(_fileno(file), m))
121 #define STAT_STRUCT struct stati64 121 #define STAT_STRUCT struct stati64
122 #else 122 #else
123 #define lfs_setmode(L,file,m) ((void)L, _setmode(_fileno(file), m)) 123 #define lfs_setmode(file, m) (_setmode(_fileno(file), m))
124 #define STAT_STRUCT struct _stati64 124 #define STAT_STRUCT struct _stati64
125 #endif 125 #endif
126#define STAT_FUNC _stati64 126#define STAT_FUNC _stati64
@@ -128,7 +128,7 @@ typedef struct dir_data {
128#else 128#else
129#define _O_TEXT 0 129#define _O_TEXT 0
130#define _O_BINARY 0 130#define _O_BINARY 0
131#define lfs_setmode(L,file,m) ((void)L, (void)file, (void)m, 0) 131#define lfs_setmode(file, m) ((void)file, (void)m, 0)
132#define STAT_STRUCT struct stat 132#define STAT_STRUCT struct stat
133#define STAT_FUNC stat 133#define STAT_FUNC stat
134#define LSTAT_FUNC lstat 134#define LSTAT_FUNC lstat
@@ -347,7 +347,7 @@ static int lfs_g_setmode (lua_State *L, FILE *f, int arg) {
347 static const int mode[] = {_O_BINARY, _O_TEXT}; 347 static const int mode[] = {_O_BINARY, _O_TEXT};
348 static const char *const modenames[] = {"binary", "text", NULL}; 348 static const char *const modenames[] = {"binary", "text", NULL};
349 int op = luaL_checkoption(L, arg, NULL, modenames); 349 int op = luaL_checkoption(L, arg, NULL, modenames);
350 int res = lfs_setmode(L, f, mode[op]); 350 int res = lfs_setmode(f, mode[op]);
351 if (res != -1) { 351 if (res != -1) {
352 int i; 352 int i;
353 lua_pushboolean(L, 1); 353 lua_pushboolean(L, 1);