summaryrefslogtreecommitdiff
path: root/apps/plugins/lua/lobject.h
diff options
context:
space:
mode:
authorWilliam Wilgus <me.theuser@yahoo.com>2018-11-11 18:27:19 -0500
committerWilliam Wilgus <me.theuser@yahoo.com>2019-07-11 00:31:41 +0200
commitc6fcb1cf45b249b059c2d53a062f9a6c7f449047 (patch)
tree229eacd12461605a8320eb7590ff83eea13538d6 /apps/plugins/lua/lobject.h
parent42240f6990156fb907a7dce7258be2f1235fab44 (diff)
downloadrockbox-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/lobject.h')
-rw-r--r--apps/plugins/lua/lobject.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/apps/plugins/lua/lobject.h b/apps/plugins/lua/lobject.h
index 93288fe0fb..26d2a81b49 100644
--- a/apps/plugins/lua/lobject.h
+++ b/apps/plugins/lua/lobject.h
@@ -201,13 +201,14 @@ typedef union TString {
201 struct { 201 struct {
202 CommonHeader; 202 CommonHeader;
203 lu_byte reserved; 203 lu_byte reserved;
204 lu_byte type;
204 unsigned int hash; 205 unsigned int hash;
205 size_t len; 206 size_t len;
206 } tsv; 207 } tsv;
207} TString; 208} TString;
208 209
209 210
210#define getstr(ts) cast(const char *, (ts) + 1) 211#define getstr(ts) (luaO_getstring(ts)) /* ROCKLUA ADDED */
211#define svalue(o) getstr(rawtsvalue(o)) 212#define svalue(o) getstr(rawtsvalue(o))
212 213
213 214
@@ -371,6 +372,7 @@ LUAI_FUNC int luaO_int2fb (unsigned int x);
371LUAI_FUNC int luaO_fb2int (int x); 372LUAI_FUNC int luaO_fb2int (int x);
372LUAI_FUNC int luaO_rawequalObj (const TValue *t1, const TValue *t2); 373LUAI_FUNC int luaO_rawequalObj (const TValue *t1, const TValue *t2);
373LUAI_FUNC int luaO_str2d (const char *s, lua_Number *result); 374LUAI_FUNC int luaO_str2d (const char *s, lua_Number *result);
375LUAI_FUNC const char *luaO_getstring(const TString * ts); /* ROCKLUA ADDED */
374LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt, 376LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt,
375 va_list argp); 377 va_list argp);
376LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...); 378LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...);