lua: stream_filter: move static variables

The variables are only used once in the initialization, so move it to
the initialization right before their usage.
This commit is contained in:
Alexandre Janniaux 2023-02-19 12:42:57 +01:00 committed by Felix Paul Kühne
parent 375414da28
commit e69380e4c2
1 changed files with 14 additions and 18 deletions

View File

@ -99,24 +99,6 @@ static int vlclua_demux_readline( lua_State *L )
return 1;
}
/*****************************************************************************
*
*****************************************************************************/
/* Functions to register */
static const luaL_Reg p_reg[] =
{
{ "peek", vlclua_demux_peek },
{ NULL, NULL }
};
/* Functions to register for parse() function call only */
static const luaL_Reg p_reg_parse[] =
{
{ "read", vlclua_demux_read },
{ "readline", vlclua_demux_readline },
{ NULL, NULL }
};
/*****************************************************************************
* Called through lua_scripts_batch_execute to call 'probe' on
* the script pointed by psz_filename.
@ -138,6 +120,13 @@ static int probe_luascript(vlc_object_t *obj, const char *filename,
luaL_openlibs( L ); /* FIXME: Don't open all the libs? */
vlclua_set_this(L, s);
/* Functions to register */
static const luaL_Reg p_reg[] =
{
{ "peek", vlclua_demux_peek },
{ NULL, NULL }
};
luaL_register_namespace( L, "vlc", p_reg );
luaopen_msg( L );
luaopen_strings( L );
@ -213,6 +202,13 @@ static int ReadDir(stream_t *s, input_item_node_t *node)
struct vlclua_playlist *sys = s->p_sys;
lua_State *L = sys->L;
/* Functions to register for parse() function call only */
static const luaL_Reg p_reg_parse[] =
{
{ "read", vlclua_demux_read },
{ "readline", vlclua_demux_readline },
{ NULL, NULL }
};
luaL_register_namespace( L, "vlc", p_reg_parse );
lua_getglobal( L, "parse" );