aboutsummaryrefslogtreecommitdiff
path: root/loadlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'loadlib.c')
-rw-r--r--loadlib.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/loadlib.c b/loadlib.c
index d1941a99..17633042 100644
--- a/loadlib.c
+++ b/loadlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: loadlib.c,v 1.129 2016/12/04 20:17:24 roberto Exp roberto $ 2** $Id: loadlib.c,v 1.130 2017/01/12 17:14:26 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**
@@ -437,9 +437,9 @@ static const char *searchpath (lua_State *L, const char *name,
437 const char *sep, 437 const char *sep,
438 const char *dirsep) { 438 const char *dirsep) {
439 luaL_Buffer msg; /* to build error message */ 439 luaL_Buffer msg; /* to build error message */
440 luaL_buffinit(L, &msg);
441 if (*sep != '\0') /* non-empty separator? */ 440 if (*sep != '\0') /* non-empty separator? */
442 name = luaL_gsub(L, name, sep, dirsep); /* replace it by 'dirsep' */ 441 name = luaL_gsub(L, name, sep, dirsep); /* replace it by 'dirsep' */
442 luaL_buffinit(L, &msg);
443 while ((path = pushnexttemplate(L, path)) != NULL) { 443 while ((path = pushnexttemplate(L, path)) != NULL) {
444 const char *filename = luaL_gsub(L, lua_tostring(L, -1), 444 const char *filename = luaL_gsub(L, lua_tostring(L, -1),
445 LUA_PATH_MARK, name); 445 LUA_PATH_MARK, name);
@@ -569,10 +569,10 @@ static int searcher_preload (lua_State *L) {
569static void findloader (lua_State *L, const char *name) { 569static void findloader (lua_State *L, const char *name) {
570 int i; 570 int i;
571 luaL_Buffer msg; /* to build error message */ 571 luaL_Buffer msg; /* to build error message */
572 luaL_buffinit(L, &msg);
573 /* push 'package.searchers' to index 3 in the stack */ 572 /* push 'package.searchers' to index 3 in the stack */
574 if (lua_getfield(L, lua_upvalueindex(1), "searchers") != LUA_TTABLE) 573 if (lua_getfield(L, lua_upvalueindex(1), "searchers") != LUA_TTABLE)
575 luaL_error(L, "'package.searchers' must be a table"); 574 luaL_error(L, "'package.searchers' must be a table");
575 luaL_buffinit(L, &msg);
576 /* iterate over available searchers to find a loader */ 576 /* iterate over available searchers to find a loader */
577 for (i = 1; ; i++) { 577 for (i = 1; ; i++) {
578 if (lua_rawgeti(L, 3, i) == LUA_TNIL) { /* no more searchers? */ 578 if (lua_rawgeti(L, 3, i) == LUA_TNIL) { /* no more searchers? */