diff options
author | William Wilgus <me.theuser@yahoo.com> | 2018-11-11 18:27:19 -0500 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2019-07-11 00:31:41 +0200 |
commit | c6fcb1cf45b249b059c2d53a062f9a6c7f449047 (patch) | |
tree | 229eacd12461605a8320eb7590ff83eea13538d6 /apps/plugins/lua/ltm.c | |
parent | 42240f6990156fb907a7dce7258be2f1235fab44 (diff) | |
download | rockbox-c6fcb1cf45b249b059c2d53a062f9a6c7f449047.tar.gz rockbox-c6fcb1cf45b249b059c2d53a062f9a6c7f449047.zip |
lua inbinary strings
Allows saving of ram by reusing strings already stored in the binary
and storing a pointer instead of malloc and copy to get them inside
the lua state
Saves about 1.5K overall
Derivative of work by bogdanm
RAM optimizations: pseudo RO strings, functions in Flash
https://github.com/elua/elua/commit/d54659b5723bcd2b1e3900362398c72c18a9aa0b
Change-Id: I21d6dcfa32523877efd9f70fb0f88f2a02872649
Diffstat (limited to 'apps/plugins/lua/ltm.c')
-rw-r--r-- | apps/plugins/lua/ltm.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/apps/plugins/lua/ltm.c b/apps/plugins/lua/ltm.c index c27f0f6fab..946028006f 100644 --- a/apps/plugins/lua/ltm.c +++ b/apps/plugins/lua/ltm.c | |||
@@ -36,10 +36,8 @@ void luaT_init (lua_State *L) { | |||
36 | "__concat", "__call" | 36 | "__concat", "__call" |
37 | }; | 37 | }; |
38 | int i; | 38 | int i; |
39 | for (i=0; i<TM_N; i++) { | 39 | for (i=0; i<TM_N; i++) /* never collect these names */ |
40 | G(L)->tmname[i] = luaS_new(L, luaT_eventname[i]); | 40 | G(L)->tmname[i] = luaS_newlloc(L, luaT_eventname[i], TSTR_INBIN | TSTR_FIXED); |
41 | luaS_fix(G(L)->tmname[i]); /* never collect these names */ | ||
42 | } | ||
43 | } | 41 | } |
44 | 42 | ||
45 | 43 | ||