A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd

lua disable bytecode dump & undump functions

Adds a flag to remove the ability to dump and load lua bytecode

saves 6+kb

Change-Id: I080323df7f03f752e0a10928e22a7ce3190a9633

+33 -5
+13
apps/plugins/lua/ldump.c
··· 15 15 #include "lstate.h" 16 16 #include "lundump.h" 17 17 18 + #ifndef LUA_DISABLE_BYTECODE 19 + 18 20 typedef struct { 19 21 lua_State* L; 20 22 lua_Writer writer; ··· 162 164 DumpFunction(f,NULL,&D); 163 165 return D.status; 164 166 } 167 + #else /* LUA_DISABLE_BYTECODE */ 168 + #include "lauxlib.h" 169 + int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip) 170 + { 171 + (void) f; 172 + (void) w; 173 + (void) data; 174 + (void) strip; 175 + return luaL_error(L, " bytecode not supported"); 176 + } 177 + #endif
+2 -2
apps/plugins/lua/luaconf.h
··· 797 797 #undef LUA_COMPAT_GFIND 798 798 #undef LUA_COMPAT_OPENLIB 799 799 800 - /* Resize heap allocated buffers */ 800 + /* Resize [STACK] allocated buffers */ 801 801 #undef LUAI_MAXVARS /*200*/ 802 802 #define LUAI_MAXVARS 100 803 803 ··· 811 811 #include "rockconf.h" 812 812 813 813 /*else*/ 814 - #define LUAC_TRUST_BINARIES 814 + #define LUA_DISABLE_BYTECODE 815 815 816 816 #endif
+13
apps/plugins/lua/lundump.c
··· 20 20 #include "lundump.h" 21 21 #include "lzio.h" 22 22 23 + #ifndef LUA_DISABLE_BYTECODE 24 + 23 25 typedef struct { 24 26 lua_State* L; 25 27 ZIO* Z; ··· 225 227 *h++=(char)sizeof(lua_Number); 226 228 *h++=(char)(((lua_Number)0.5)==0); /* is lua_Number integral? */ 227 229 } 230 + 231 + #else /* LUA_DISABLE_BYTECODE */ 232 + #include "lauxlib.h" 233 + Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name) 234 + { 235 + (void) Z; 236 + (void) buff; 237 + luaL_error(L, LUA_QL("%s") " bytecode not supported", name); 238 + return NULL; 239 + } 240 + #endif
+5 -3
apps/plugins/lua/lundump.h
··· 13 13 /* load one chunk; from lundump.c */ 14 14 LUAI_FUNC Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name); 15 15 16 + /* dump one chunk; from ldump.c */ 17 + LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip); 18 + 19 + #ifndef LUA_DISABLE_BYTECODE 16 20 /* make header; from lundump.c */ 17 21 LUAI_FUNC void luaU_header (char* h); 18 - 19 - /* dump one chunk; from ldump.c */ 20 - LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip); 21 22 22 23 #ifdef luac_c 23 24 /* print one chunk; from print.c */ ··· 33 34 /* size of header of binary files */ 34 35 #define LUAC_HEADERSIZE 12 35 36 37 + #endif /* LUA_DISABLE_BYTECODE */ 36 38 #endif