summaryrefslogtreecommitdiffstats
path: root/apps/plugins/lua/lobject.h
diff options
context:
space:
mode:
authorWilliam Wilgus <me.theuser@yahoo.com>2019-07-12 05:23:52 -0500
committerWilliam Wilgus <me.theuser@yahoo.com>2019-07-28 15:17:48 +0200
commit45bd14b392622cb58e967a24e4652c510b3d43e4 (patch)
tree22bd2e5cafc2d82ecc4773f83de7f86515b4db43 /apps/plugins/lua/lobject.h
parent4beafe16fafc2e5c59734ef065a6f8d23766520d (diff)
downloadrockbox-45bd14b392622cb58e967a24e4652c510b3d43e4.tar.gz
rockbox-45bd14b392622cb58e967a24e4652c510b3d43e4.tar.bz2
rockbox-45bd14b392622cb58e967a24e4652c510b3d43e4.zip
Lua Add Emergency Garbage Collector
Derivative of work by RobertGabrielJakabosky http://lua-users.org/wiki/EmergencyGarbageCollector I've only implemented the not enough memory part and expanded this idea to adding a mechanism to signal the OOM condition of the plugin buffer which allows us to only grab the playback buffer after garbage collection fails (SO THE MUSIC KEEPS PLAYING AS LONG AS POSSIBLE) Change-Id: I684fb98b540ffc01f7ba324ab5b761ceb59b9f9b
Diffstat (limited to 'apps/plugins/lua/lobject.h')
-rw-r--r--apps/plugins/lua/lobject.h36
1 files changed, 21 insertions, 15 deletions
diff --git a/apps/plugins/lua/lobject.h b/apps/plugins/lua/lobject.h
index 26d2a81b49..028ff0355b 100644
--- a/apps/plugins/lua/lobject.h
+++ b/apps/plugins/lua/lobject.h
@@ -117,42 +117,48 @@ typedef struct lua_TValue {
#define setnilvalue(obj) ((obj)->tt=LUA_TNIL)
#define setnvalue(obj,x) \
- { TValue *i_o=(obj); i_o->value.n=(x); i_o->tt=LUA_TNUMBER; }
+ { lua_Number i_x = (x); TValue *i_o=(obj); i_o->value.n=i_x; i_o->tt=LUA_TNUMBER; }
#define setpvalue(obj,x) \
- { TValue *i_o=(obj); i_o->value.p=(x); i_o->tt=LUA_TLIGHTUSERDATA; }
+ { void *i_x = (x); TValue *i_o=(obj); i_o->value.p=i_x; i_o->tt=LUA_TLIGHTUSERDATA; }
#define setbvalue(obj,x) \
- { TValue *i_o=(obj); i_o->value.b=(x); i_o->tt=LUA_TBOOLEAN; }
+ { int i_x = (x); TValue *i_o=(obj); i_o->value.b=i_x; i_o->tt=LUA_TBOOLEAN; }
#define setsvalue(L,obj,x) \
- { TValue *i_o=(obj); \
- i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TSTRING; \
+ { GCObject *i_x = cast(GCObject *, (x)); \
+ TValue *i_o=(obj); \
+ i_o->value.gc=i_x; i_o->tt=LUA_TSTRING; \
checkliveness(G(L),i_o); }
#define setuvalue(L,obj,x) \
- { TValue *i_o=(obj); \
- i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TUSERDATA; \
+ { GCObject *i_x = cast(GCObject *, (x)); \
+ TValue *i_o=(obj); \
+ i_o->value.gc=i_x; i_o->tt=LUA_TUSERDATA; \
checkliveness(G(L),i_o); }
#define setthvalue(L,obj,x) \
- { TValue *i_o=(obj); \
- i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTHREAD; \
+ { GCObject *i_x = cast(GCObject *, (x)); \
+ TValue *i_o=(obj); \
+ i_o->value.gc=i_x; i_o->tt=LUA_TTHREAD; \
checkliveness(G(L),i_o); }
#define setclvalue(L,obj,x) \
- { TValue *i_o=(obj); \
- i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TFUNCTION; \
+ { GCObject *i_x = cast(GCObject *, (x)); \
+ TValue *i_o=(obj); \
+ i_o->value.gc=i_x; i_o->tt=LUA_TFUNCTION; \
checkliveness(G(L),i_o); }
#define sethvalue(L,obj,x) \
- { TValue *i_o=(obj); \
- i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTABLE; \
+ { GCObject *i_x = cast(GCObject *, (x)); \
+ TValue *i_o=(obj); \
+ i_o->value.gc=i_x; i_o->tt=LUA_TTABLE; \
checkliveness(G(L),i_o); }
#define setptvalue(L,obj,x) \
- { TValue *i_o=(obj); \
- i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TPROTO; \
+ { GCObject *i_x = cast(GCObject *, (x)); \
+ TValue *i_o=(obj); \
+ i_o->value.gc=i_x; i_o->tt=LUA_TPROTO; \
checkliveness(G(L),i_o); }