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

Tiny code factorization

parent 7a5fd4be
...@@ -32,20 +32,12 @@ module_t *vlc_module_create (vlc_object_t *obj) ...@@ -32,20 +32,12 @@ module_t *vlc_module_create (vlc_object_t *obj)
#ifndef HAVE_SHARED_LIBVLC #ifndef HAVE_SHARED_LIBVLC
module->p_symbols = &obj->p_libvlc_global->p_module_bank->symbols; module->p_symbols = &obj->p_libvlc_global->p_module_bank->symbols;
#endif #endif
module->b_loaded = module->b_submodule = VLC_FALSE;
module->b_reentrant = module->b_unloadable = VLC_TRUE; module->b_reentrant = module->b_unloadable = VLC_TRUE;
module->psz_object_name = module->psz_longname = default_name; module->psz_object_name = module->psz_longname = default_name;
module->psz_help = module->psz_shortname = NULL;
module->pp_shortcuts[0] = default_name; module->pp_shortcuts[0] = default_name;
for (unsigned i = 1; i < MODULE_SHORTCUT_MAX; i++)
module->pp_shortcuts[i] = NULL;
module->i_cpu = 0; module->i_cpu = 0;
module->psz_program = NULL;
module->psz_capability = ""; module->psz_capability = "";
module->i_score = 1; module->i_score = 1;
module->pf_activate = NULL;
module->pf_deactivate = NULL;
return module; return module;
} }
...@@ -74,8 +66,6 @@ module_t *vlc_submodule_create (module_t *module) ...@@ -74,8 +66,6 @@ module_t *vlc_submodule_create (module_t *module)
submodule->psz_capability = module->psz_capability; submodule->psz_capability = module->psz_capability;
submodule->i_score = module->i_score; submodule->i_score = module->i_score;
submodule->i_cpu = module->i_cpu; submodule->i_cpu = module->i_cpu;
submodule->pf_activate = NULL;
submodule->pf_deactivate = NULL;
return submodule; return submodule;
} }
......
...@@ -1231,7 +1231,7 @@ static int AllocateBuiltinModule( vlc_object_t * p_this, ...@@ -1231,7 +1231,7 @@ static int AllocateBuiltinModule( vlc_object_t * p_this,
/* Now that we have successfully loaded the module, we can /* Now that we have successfully loaded the module, we can
* allocate a structure for it */ * allocate a structure for it */
p_module = vlc_object_create( p_this, VLC_OBJECT_MODULE ); p_module = vlc_module_create( p_this );
if( p_module == NULL ) if( p_module == NULL )
{ {
msg_Err( p_this, "out of memory" ); msg_Err( p_this, "out of memory" );
...@@ -1785,7 +1785,7 @@ static void CacheLoad( vlc_object_t *p_this ) ...@@ -1785,7 +1785,7 @@ static void CacheLoad( vlc_object_t *p_this )
if( pp_cache[i]->b_junk ) continue; if( pp_cache[i]->b_junk ) continue;
pp_cache[i]->p_module = vlc_object_create( p_this, VLC_OBJECT_MODULE ); pp_cache[i]->p_module = vlc_module_create( p_this );
/* Load additional infos */ /* Load additional infos */
LOAD_STRING( pp_cache[i]->p_module->psz_object_name ); LOAD_STRING( pp_cache[i]->p_module->psz_object_name );
...@@ -1814,10 +1814,7 @@ static void CacheLoad( vlc_object_t *p_this ) ...@@ -1814,10 +1814,7 @@ static void CacheLoad( vlc_object_t *p_this )
while( i_submodules-- ) while( i_submodules-- )
{ {
module_t *p_module = vlc_object_create( p_this, VLC_OBJECT_MODULE); module_t *p_module = vlc_submodule_create( pp_cache[i]->p_module );
vlc_object_attach( p_module, pp_cache[i]->p_module );
p_module->b_submodule = VLC_TRUE;
LOAD_STRING( p_module->psz_object_name ); LOAD_STRING( p_module->psz_object_name );
LOAD_STRING( p_module->psz_shortname ); LOAD_STRING( p_module->psz_shortname );
LOAD_STRING( p_module->psz_longname ); LOAD_STRING( p_module->psz_longname );
......
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