commit 522481a788ee33d68389e0e32f498b7a3e304d39
parent 37b49aa4516934fcb23bbdb62a82ab1916275ac8
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Thu, 6 Oct 2005 17:45:48 -0300
avoid some warnings
Diffstat:
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/loadlib.c b/loadlib.c
@@ -1,5 +1,5 @@
/*
-** $Id: loadlib.c,v 1.45 2005/09/30 13:50:05 roberto Exp roberto $
+** $Id: loadlib.c,v 1.46 2005/10/03 14:36:45 roberto Exp roberto $
** Dynamic library loader for Lua
** See Copyright Notice in lua.h
**
@@ -97,16 +97,18 @@ static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {
#undef setprogdir
-void setprogdir (lua_State *L) {
+static void setprogdir (lua_State *L) {
char buff[MAX_PATH + 1];
char *lb;
DWORD nsize = sizeof(buff)/sizeof(char);
DWORD n = GetModuleFileName(NULL, buff, nsize);
if (n == 0 || n == nsize || (lb = strrchr(buff, '\\')) == NULL)
luaL_error(L, "unable to get ModuleFileName");
- *lb = '\0';
- luaL_gsub(L, lua_tostring(L, -1), LUA_EXECDIR, buff);
- lua_remove(L, -2); /* remove original string */
+ else {
+ *lb = '\0';
+ luaL_gsub(L, lua_tostring(L, -1), LUA_EXECDIR, buff);
+ lua_remove(L, -2); /* remove original string */
+ }
}