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

- Remove config_FindModule as module_Find nowadays does the same thing

 - Use module_Exists as appropriate
 - Rename module_FindName as module_Find
parent 9cda1945
...@@ -210,7 +210,6 @@ VLC_EXPORT( int, __config_SaveConfigFile, ( vlc_object_t *, const char * ) ); ...@@ -210,7 +210,6 @@ VLC_EXPORT( int, __config_SaveConfigFile, ( vlc_object_t *, const char * ) );
VLC_EXPORT( void, __config_ResetAll, ( vlc_object_t * ) ); VLC_EXPORT( void, __config_ResetAll, ( vlc_object_t * ) );
VLC_EXPORT( module_config_t *, config_FindConfig,( vlc_object_t *, const char * ) ); VLC_EXPORT( module_config_t *, config_FindConfig,( vlc_object_t *, const char * ) );
VLC_EXPORT( module_t *, config_FindModule,( vlc_object_t *, const char * ) );
VLC_EXPORT( int, config_Duplicate,( module_t *, const module_config_t *, size_t )); VLC_EXPORT( int, config_Duplicate,( module_t *, const module_config_t *, size_t ));
......
...@@ -35,9 +35,8 @@ VLC_EXPORT( void, __module_Unneed, ( vlc_object_t *, module_t * ) ); ...@@ -35,9 +35,8 @@ VLC_EXPORT( void, __module_Unneed, ( vlc_object_t *, module_t * ) );
#define module_Exists(a,b) __module_Exists(VLC_OBJECT(a),b) #define module_Exists(a,b) __module_Exists(VLC_OBJECT(a),b)
VLC_EXPORT( vlc_bool_t, __module_Exists, ( vlc_object_t *, const char * ) ); VLC_EXPORT( vlc_bool_t, __module_Exists, ( vlc_object_t *, const char * ) );
/* Use only if you know what you're doing... */ #define module_Find(a,b) __module_Find(VLC_OBJECT(a),b)
#define module_FindName(a,b) __module_FindName(VLC_OBJECT(a),b) VLC_EXPORT( module_t *, __module_Find, ( vlc_object_t *, const char * ) );
VLC_EXPORT( module_t *, __module_FindName, ( vlc_object_t *, const char * ) );
VLC_EXPORT( void, module_Put, ( module_t *module ) ); VLC_EXPORT( void, module_Put, ( module_t *module ) );
VLC_EXPORT( module_config_t *, module_GetConfig, ( const module_t *, unsigned * ) ); VLC_EXPORT( module_config_t *, module_GetConfig, ( const module_t *, unsigned * ) );
......
...@@ -139,7 +139,7 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -139,7 +139,7 @@ static int OpenDecoder( vlc_object_t *p_this )
/* HACK: Don't use this codec if we don't have an mpga audio filter */ /* HACK: Don't use this codec if we don't have an mpga audio filter */
if( p_dec->i_object_type == VLC_OBJECT_DECODER && if( p_dec->i_object_type == VLC_OBJECT_DECODER &&
!config_FindModule( p_this, "mpgatofixed32" ) ) !module_Exists( p_this, "mpgatofixed32" ) )
{ {
return VLC_EGENERIC; return VLC_EGENERIC;
} }
......
...@@ -336,10 +336,10 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -336,10 +336,10 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
if( data->i_type == TYPE_CATEGORY ) if( data->i_type == TYPE_CATEGORY )
return; return;
else if( data->i_type == TYPE_MODULE ) else if( data->i_type == TYPE_MODULE )
p_module = module_FindName( VLC_OBJECT(p_intf), data->psz_name ); p_module = module_Find( VLC_OBJECT(p_intf), data->psz_name );
else else
{ {
p_module = module_FindName( VLC_OBJECT(p_intf), "main" ); p_module = module_Find( VLC_OBJECT(p_intf), "main" );
assert( p_module ); assert( p_module );
} }
......
...@@ -212,7 +212,7 @@ void ExtVideo::ChangeVFiltersString( char *psz_name, vlc_bool_t b_add ) ...@@ -212,7 +212,7 @@ void ExtVideo::ChangeVFiltersString( char *psz_name, vlc_bool_t b_add )
/* Please leave p_libvlc_global. This is where cached modules are /* Please leave p_libvlc_global. This is where cached modules are
* stored. We're not trying to find a module instance. */ * stored. We're not trying to find a module instance. */
module_t *p_obj = module_FindName( p_intf, psz_name ); module_t *p_obj = module_Find( p_intf, psz_name );
if( !p_obj ) if( !p_obj )
{ {
msg_Err( p_intf, "Unable to find filter module \"%s\n.", psz_name ); msg_Err( p_intf, "Unable to find filter module \"%s\n.", psz_name );
......
...@@ -1031,7 +1031,7 @@ void KeySelectorControl::finish() ...@@ -1031,7 +1031,7 @@ void KeySelectorControl::finish()
table->setColumnCount( 2 ); table->setColumnCount( 2 );
table->setAlternatingRowColors( true ); table->setAlternatingRowColors( true );
module_t *p_main = config_FindModule( p_this, "main" ); module_t *p_main = module_Find( p_this, "main" );
assert( p_main ); assert( p_main );
unsigned confsize; unsigned confsize;
...@@ -1056,6 +1056,7 @@ void KeySelectorControl::finish() ...@@ -1056,6 +1056,7 @@ void KeySelectorControl::finish()
} }
} }
module_PutConfig (p_config); module_PutConfig (p_config);
module_Put (p_module);
table->resizeColumnToContents( 0 ); table->resizeColumnToContents( 0 );
......
...@@ -84,7 +84,6 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input ) ...@@ -84,7 +84,6 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input )
/* Now add user filters */ /* Now add user filters */
if( var_Type( p_aout, "visual" ) == 0 ) if( var_Type( p_aout, "visual" ) == 0 )
{ {
module_t *p_module;
var_Create( p_aout, "visual", VLC_VAR_STRING | VLC_VAR_HASCHOICE ); var_Create( p_aout, "visual", VLC_VAR_STRING | VLC_VAR_HASCHOICE );
text.psz_string = _("Visualizations"); text.psz_string = _("Visualizations");
var_Change( p_aout, "visual", VLC_VAR_SETTEXT, &text, NULL ); var_Change( p_aout, "visual", VLC_VAR_SETTEXT, &text, NULL );
...@@ -98,16 +97,14 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input ) ...@@ -98,16 +97,14 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input )
var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text ); var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text );
/* Look for goom plugin */ /* Look for goom plugin */
p_module = config_FindModule( VLC_OBJECT(p_aout), "goom" ); if( module_Exists( VLC_OBJECT(p_aout), "goom" ) )
if( p_module )
{ {
val.psz_string = "goom"; text.psz_string = "Goom"; val.psz_string = "goom"; text.psz_string = "Goom";
var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text ); var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text );
} }
/* Look for galaktos plugin */ /* Look for galaktos plugin */
p_module = config_FindModule( VLC_OBJECT(p_aout), "galaktos" ); if( module_Exists( VLC_OBJECT(p_aout), "galaktos" ) )
if( p_module )
{ {
val.psz_string = "galaktos"; text.psz_string = "GaLaktos"; val.psz_string = "galaktos"; text.psz_string = "GaLaktos";
var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text ); var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text );
......
...@@ -483,34 +483,6 @@ module_config_t *config_FindConfig( vlc_object_t *p_this, const char *psz_name ) ...@@ -483,34 +483,6 @@ module_config_t *config_FindConfig( vlc_object_t *p_this, const char *psz_name )
return NULL; return NULL;
} }
/*****************************************************************************
* config_FindModule: find a specific module structure.
*****************************************************************************/
module_t *config_FindModule( vlc_object_t *p_this, const char *psz_name )
{
vlc_list_t *p_list;
module_t *p_module, *p_result = NULL;
int i_index;
if( !psz_name ) return NULL;
p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_module = (module_t *)p_list->p_values[i_index].p_object;
if( !strcmp( p_module->psz_object_name, psz_name ) )
{
p_result = p_module;
break;
}
}
vlc_list_release( p_list );
return p_result;
}
/***************************************************************************** /*****************************************************************************
* config_Duplicate: creates a duplicate of a module's configuration data. * config_Duplicate: creates a duplicate of a module's configuration data.
***************************************************************************** *****************************************************************************
......
...@@ -48,7 +48,6 @@ config_ChainDestroy ...@@ -48,7 +48,6 @@ config_ChainDestroy
__config_ChainParse __config_ChainParse
config_Duplicate config_Duplicate
config_FindConfig config_FindConfig
config_FindModule
config_GetDataDir config_GetDataDir
__config_GetFloat __config_GetFloat
__config_GetInt __config_GetInt
...@@ -145,7 +144,7 @@ IsUTF8 ...@@ -145,7 +144,7 @@ IsUTF8
LocaleFree LocaleFree
mdate mdate
__module_Exists __module_Exists
__module_FindName __module_Find
module_GetConfig module_GetConfig
module_GetHelp module_GetHelp
module_GetName module_GetName
......
...@@ -686,9 +686,9 @@ void __module_Unneed( vlc_object_t * p_this, module_t * p_module ) ...@@ -686,9 +686,9 @@ void __module_Unneed( vlc_object_t * p_this, module_t * p_module )
} }
/***************************************************************************** /*****************************************************************************
* module_FindName: get a pointer to a module_t given it's name. * module_Find: get a pointer to a module_t given it's name.
*****************************************************************************/ *****************************************************************************/
module_t *__module_FindName( vlc_object_t *p_this, const char * psz_name ) module_t *__module_Find( vlc_object_t *p_this, const char * psz_name )
{ {
vlc_list_t *p_list; vlc_list_t *p_list;
int i; int i;
...@@ -711,7 +711,7 @@ module_t *__module_FindName( vlc_object_t *p_this, const char * psz_name ) ...@@ -711,7 +711,7 @@ module_t *__module_FindName( vlc_object_t *p_this, const char * psz_name )
/***************************************************************************** /*****************************************************************************
* module_Put: release a module_t pointer from module_FindName(). * module_Put: release a module_t pointer from module_Find().
*****************************************************************************/ *****************************************************************************/
void module_Put ( module_t *module ) void module_Put ( module_t *module )
{ {
...@@ -726,7 +726,7 @@ void module_Put ( module_t *module ) ...@@ -726,7 +726,7 @@ void module_Put ( module_t *module )
*****************************************************************************/ *****************************************************************************/
vlc_bool_t __module_Exists( vlc_object_t *p_this, const char * psz_name ) vlc_bool_t __module_Exists( vlc_object_t *p_this, const char * psz_name )
{ {
module_t *p_module = __module_FindName( p_this, psz_name ); module_t *p_module = __module_Find( p_this, psz_name );
if( p_module ) if( p_module )
{ {
module_Put( p_module ); module_Put( p_module );
......
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