Commit 17746f42 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Lua: kill relocations

parent 6409fdbc
...@@ -49,19 +49,17 @@ static const luaL_Reg p_reg[] = ...@@ -49,19 +49,17 @@ static const luaL_Reg p_reg[] =
* Extensions capabilities * Extensions capabilities
* Note: #define and ppsz_capabilities must be in sync * Note: #define and ppsz_capabilities must be in sync
*/ */
static const char const caps[][20] = {
#define EXT_HAS_MENU (1 << 0) ///< Hook: menu #define EXT_HAS_MENU (1 << 0) ///< Hook: menu
#define EXT_TRIGGER_ONLY (1 << 1) ///< Hook: trigger. Not activable
#define EXT_INPUT_LISTENER (1 << 2) ///< Hook: input_changed
#define EXT_META_LISTENER (1 << 3) ///< Hook: meta_changed
#define EXT_PLAYING_LISTENER (1 << 4) ///< Hook: status_changed
static const char* const ppsz_capabilities[] = {
"menu", "menu",
#define EXT_TRIGGER_ONLY (1 << 1) ///< Hook: trigger. Not activable
"trigger", "trigger",
#define EXT_INPUT_LISTENER (1 << 2) ///< Hook: input_changed
"input-listener", "input-listener",
#define EXT_META_LISTENER (1 << 3) ///< Hook: meta_changed
"meta-listener", "meta-listener",
#define EXT_PLAYING_LISTENER (1 << 4) ///< Hook: status_changed
"playing-listener", "playing-listener",
NULL
}; };
#define WATCH_TIMER_PERIOD (10 * CLOCK_FREQ) ///< 10s period for the timer #define WATCH_TIMER_PERIOD (10 * CLOCK_FREQ) ///< 10s period for the timer
...@@ -381,17 +379,14 @@ int ScanLuaCallback( vlc_object_t *p_this, const char *psz_filename, ...@@ -381,17 +379,14 @@ int ScanLuaCallback( vlc_object_t *p_this, const char *psz_filename,
{ {
/* Key is at index -2 and value at index -1. Discard key */ /* Key is at index -2 and value at index -1. Discard key */
const char *psz_cap = luaL_checkstring( L, -1 ); const char *psz_cap = luaL_checkstring( L, -1 );
int i_cap = 0;
bool b_ok = false; bool b_ok = false;
/* Find this capability's flag */ /* Find this capability's flag */
for( const char *iter = *ppsz_capabilities; for( size_t i = 0; i < sizeof(caps)/sizeof(caps[0]); i++ )
iter != NULL;
iter = ppsz_capabilities[ ++i_cap ])
{ {
if( !strcmp( iter, psz_cap ) ) if( !strcmp( caps[i], psz_cap ) )
{ {
/* Flag it! */ /* Flag it! */
p_ext->p_sys->i_capabilities |= 1 << i_cap; p_ext->p_sys->i_capabilities |= 1 << i;
b_ok = true; b_ok = true;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment