[vlc-commits] Remove module_t.psz_object_name
Rémi Denis-Courmont
git at videolan.org
Mon Aug 15 19:45:24 CEST 2011
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Aug 15 19:11:00 2011 +0300| [224742db1cec276c02806025f99eb6a570f67a61] | committer: Rémi Denis-Courmont
Remove module_t.psz_object_name
This is the same as module_t.pp_shortcuts[0].
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=224742db1cec276c02806025f99eb6a570f67a61
---
src/modules/cache.c | 9 ---------
src/modules/entry.c | 8 ++------
src/modules/modules.c | 10 ++++------
src/modules/modules.h | 1 -
4 files changed, 6 insertions(+), 22 deletions(-)
diff --git a/src/modules/cache.c b/src/modules/cache.c
index ef592be..d903f75 100644
--- a/src/modules/cache.c
+++ b/src/modules/cache.c
@@ -202,7 +202,6 @@ size_t CacheLoad( vlc_object_t *p_this, const char *dir, module_cache_t **r )
module = vlc_module_create();
/* Load additional infos */
- LOAD_STRING(module->object_name);
LOAD_STRING(module->psz_shortname);
LOAD_STRING(module->psz_longname);
LOAD_STRING(module->psz_help);
@@ -210,8 +209,6 @@ size_t CacheLoad( vlc_object_t *p_this, const char *dir, module_cache_t **r )
LOAD_IMMEDIATE(module->i_shortcuts);
if (module->i_shortcuts > MODULE_SHORTCUT_MAX)
goto error;
- else if (module->i_shortcuts == 0)
- module->pp_shortcuts = NULL;
else
{
module->pp_shortcuts =
@@ -237,9 +234,7 @@ size_t CacheLoad( vlc_object_t *p_this, const char *dir, module_cache_t **r )
while( i_submodules-- )
{
module_t *submodule = vlc_submodule_create (module);
- free (submodule->object_name);
free (submodule->pp_shortcuts);
- LOAD_STRING(submodule->object_name);
LOAD_STRING(submodule->psz_shortname);
LOAD_STRING(submodule->psz_longname);
LOAD_STRING(submodule->psz_help);
@@ -247,8 +242,6 @@ size_t CacheLoad( vlc_object_t *p_this, const char *dir, module_cache_t **r )
LOAD_IMMEDIATE(submodule->i_shortcuts);
if (submodule->i_shortcuts > MODULE_SHORTCUT_MAX)
goto error;
- else if (submodule->i_shortcuts == 0)
- submodule->pp_shortcuts = NULL;
else
{
submodule->pp_shortcuts =
@@ -497,7 +490,6 @@ static int CacheSaveBank (FILE *file, const module_cache_t *cache,
uint32_t i_submodule;
/* Save additional infos */
- SAVE_STRING(module->object_name);
SAVE_STRING(module->psz_shortname);
SAVE_STRING(module->psz_longname);
SAVE_STRING(module->psz_help);
@@ -541,7 +533,6 @@ static int CacheSaveSubmodule( FILE *file, const module_t *p_module )
if( CacheSaveSubmodule( file, p_module->next ) )
goto error;
- SAVE_STRING( p_module->object_name );
SAVE_STRING( p_module->psz_shortname );
SAVE_STRING( p_module->psz_longname );
SAVE_STRING( p_module->psz_help );
diff --git a/src/modules/entry.c b/src/modules/entry.c
index e13d89c..c29c4d4 100644
--- a/src/modules/entry.c
+++ b/src/modules/entry.c
@@ -39,7 +39,6 @@ static void vlc_module_destruct (gc_object_t *obj)
module_t *module = vlc_priv (obj, module_t);
free (module->pp_shortcuts);
- free (module->object_name);
free (module);
}
@@ -49,7 +48,6 @@ module_t *vlc_module_create (void)
if (module == NULL)
return NULL;
- module->object_name = NULL;
module->next = NULL;
module->submodule = NULL;
module->parent = NULL;
@@ -82,8 +80,8 @@ module_t *vlc_module_create (void)
static void vlc_submodule_destruct (gc_object_t *obj)
{
module_t *module = vlc_priv (obj, module_t);
+
free (module->pp_shortcuts);
- free (module->object_name);
free (module);
}
@@ -107,7 +105,6 @@ module_t *vlc_submodule_create (module_t *module)
submodule->pp_shortcuts[0] = module->pp_shortcuts[0]; /* object name */
submodule->i_shortcuts = 1;
- submodule->object_name = strdup (module->object_name);
submodule->psz_shortname = module->psz_shortname;
submodule->psz_longname = module->psz_longname;
submodule->psz_capability = module->psz_capability;
@@ -222,8 +219,7 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
{
const char *value = va_arg (ap, const char *);
- assert (module->object_name == NULL);
- module->object_name = strdup (value);
+ assert (module->i_shortcuts == 0);
module->pp_shortcuts = malloc( sizeof( char ** ) );
module->pp_shortcuts[0] = (char*)value; /* dooh! */
module->i_shortcuts = 1;
diff --git a/src/modules/modules.c b/src/modules/modules.c
index 7d90ad7..cf7bad02 100644
--- a/src/modules/modules.c
+++ b/src/modules/modules.c
@@ -203,9 +203,9 @@ bool module_provides( const module_t *m, const char *cap )
*/
const char *module_get_object( const module_t *m )
{
- if (unlikely(m->object_name == NULL))
+ if (unlikely(m->i_shortcuts == 0))
return "unnamed";
- return m->object_name;
+ return m->pp_shortcuts[0];
}
/**
@@ -680,11 +680,9 @@ module_t *module_find (const char *name)
for (size_t i = 0; (module = list[i]) != NULL; i++)
{
- const char *objname = module->object_name;
-
- if (unlikely(objname == NULL))
+ if (unlikely(module->i_shortcuts == 0))
continue;
- if (!strcmp (objname, name))
+ if (!strcmp (module->pp_shortcuts[0], name))
{
module_hold (module);
break;
diff --git a/src/modules/modules.h b/src/modules/modules.h
index 2ef8136..3e06857 100644
--- a/src/modules/modules.h
+++ b/src/modules/modules.h
@@ -62,7 +62,6 @@ typedef void * module_handle_t;
*/
struct module_t
{
- char *object_name;
gc_object_t vlc_gc_data;
module_t *next;
More information about the vlc-commits
mailing list