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/llex.c | |
| parent | 42240f6990156fb907a7dce7258be2f1235fab44 (diff) | |
| download | rockbox-c6fcb1cf45b249b059c2d53a062f9a6c7f449047.zip rockbox-c6fcb1cf45b249b059c2d53a062f9a6c7f449047.tar.gz rockbox-c6fcb1cf45b249b059c2d53a062f9a6c7f449047.tar.bz2 rockbox-c6fcb1cf45b249b059c2d53a062f9a6c7f449047.tar.xz | |
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/llex.c')
| -rw-r--r-- | apps/plugins/lua/llex.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/apps/plugins/lua/llex.c b/apps/plugins/lua/llex.c index 6f78d48..723d46c 100644 --- a/apps/plugins/lua/llex.c +++ b/apps/plugins/lua/llex.c @@ -64,8 +64,8 @@ static void save (LexState *ls, int c) { void luaX_init (lua_State *L) { int i; for (i=0; i<NUM_RESERVED; i++) { - TString *ts = luaS_new(L, luaX_tokens[i]); - luaS_fix(ts); /* reserved words are never collected */ + /* reserved words are never collected */ + TString *ts = luaS_newlloc(L, luaX_tokens[i], TSTR_INBIN | TSTR_FIXED); lua_assert(strlen(luaX_tokens[i])+1 <= TOKEN_LEN); ts->tsv.reserved = cast_byte(i+1); /* reserved word */ } |