aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-10-06 17:46:10 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-10-06 17:46:10 -0300
commit522481a788ee33d68389e0e32f498b7a3e304d39 (patch)
tree4cfb384fe90bab67614498ad5e384a99abf11a9d
parent37b49aa4516934fcb23bbdb62a82ab1916275ac8 (diff)
downloadlua-522481a788ee33d68389e0e32f498b7a3e304d39.tar.gz
lua-522481a788ee33d68389e0e32f498b7a3e304d39.tar.bz2
lua-522481a788ee33d68389e0e32f498b7a3e304d39.zip
avoid some warnings
-rw-r--r--loadlib.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/loadlib.c b/loadlib.c
index 5607897b..802cf8d7 100644
--- a/loadlib.c
+++ b/loadlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: loadlib.c,v 1.45 2005/09/30 13:50:05 roberto Exp roberto $ 2** $Id: loadlib.c,v 1.46 2005/10/03 14:36:45 roberto Exp roberto $
3** Dynamic library loader for Lua 3** Dynamic library loader for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5** 5**
@@ -97,16 +97,18 @@ static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {
97 97
98#undef setprogdir 98#undef setprogdir
99 99
100void setprogdir (lua_State *L) { 100static void setprogdir (lua_State *L) {
101 char buff[MAX_PATH + 1]; 101 char buff[MAX_PATH + 1];
102 char *lb; 102 char *lb;
103 DWORD nsize = sizeof(buff)/sizeof(char); 103 DWORD nsize = sizeof(buff)/sizeof(char);
104 DWORD n = GetModuleFileName(NULL, buff, nsize); 104 DWORD n = GetModuleFileName(NULL, buff, nsize);
105 if (n == 0 || n == nsize || (lb = strrchr(buff, '\\')) == NULL) 105 if (n == 0 || n == nsize || (lb = strrchr(buff, '\\')) == NULL)
106 luaL_error(L, "unable to get ModuleFileName"); 106 luaL_error(L, "unable to get ModuleFileName");
107 *lb = '\0'; 107 else {
108 luaL_gsub(L, lua_tostring(L, -1), LUA_EXECDIR, buff); 108 *lb = '\0';
109 lua_remove(L, -2); /* remove original string */ 109 luaL_gsub(L, lua_tostring(L, -1), LUA_EXECDIR, buff);
110 lua_remove(L, -2); /* remove original string */
111 }
110} 112}
111 113
112 114