1
0
Fork 0
forked from len0rd/rockbox

lua optimize current_path function

frees up around 500 bytes by using the builtin string functionality

Change-Id: Icd4ec921d3fec339b8a4b7f80c9c63d51d4c101c
This commit is contained in:
William Wilgus 2018-10-13 13:35:01 -04:00
parent 0b7a8d5afd
commit 07fed9053a
4 changed files with 13 additions and 24 deletions

View file

@ -54,7 +54,10 @@ static const char *pushnexttemplate (lua_State *L, const char *path) {
static const char *findfile (lua_State *L, const char *name,
const char *pname) {
const char *path, *current_path = get_current_path(L, 2);
get_current_path(L, 2);
const char *current_path = lua_tostring(L, -1);
const char *path;
name = luaL_gsub(L, name, ".", LUA_DIRSEP);
lua_getfield(L, LUA_ENVIRONINDEX, pname);
path = lua_tostring(L, -1);