diff options
| author | William Wilgus <me.theuser@yahoo.com> | 2018-10-13 13:35:01 -0400 |
|---|---|---|
| committer | William Wilgus <me.theuser@yahoo.com> | 2018-10-15 18:24:10 +0200 |
| commit | 07fed9053a476b4c6e5ecd23fc43ec84f4094978 (patch) | |
| tree | da366faad51087b2e5000a1d9d3659d5bd1a73a8 /apps/plugins/lua/loadlib.c | |
| parent | 0b7a8d5afd3d751fd0f6454098bc9fd1d05ee764 (diff) | |
| download | rockbox-07fed9053a476b4c6e5ecd23fc43ec84f4094978.zip rockbox-07fed9053a476b4c6e5ecd23fc43ec84f4094978.tar.gz rockbox-07fed9053a476b4c6e5ecd23fc43ec84f4094978.tar.bz2 rockbox-07fed9053a476b4c6e5ecd23fc43ec84f4094978.tar.xz | |
lua optimize current_path function
frees up around 500 bytes by using the builtin string functionality
Change-Id: Icd4ec921d3fec339b8a4b7f80c9c63d51d4c101c
Diffstat (limited to 'apps/plugins/lua/loadlib.c')
| -rw-r--r-- | apps/plugins/lua/loadlib.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/plugins/lua/loadlib.c b/apps/plugins/lua/loadlib.c index 1cc7ebd..87873f1 100644 --- a/apps/plugins/lua/loadlib.c +++ b/apps/plugins/lua/loadlib.c @@ -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); |