Commit 5dc2da73 authored by Sam Hocevar's avatar Sam Hocevar

* ./src/misc/modules.c: the module linked list is going bye bye. We now use

    the vlc_object_* and vlc_list_* functions to manage modules. The Win32
    interface doesn't build, but I'll fix this.
parent 17e19cc1
......@@ -2,7 +2,7 @@
* modules.h : Module management functions.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: modules.h,v 1.59 2002/07/31 20:56:50 sam Exp $
* $Id: modules.h,v 1.60 2002/08/15 12:11:15 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -45,11 +45,6 @@ struct module_bank_t
{
VLC_COMMON_MEMBERS
module_t * first; /* First module in the bank */
int i_count; /* Number of allocated modules */
vlc_mutex_t lock; /* Global lock -- you can't imagine how awful *
it is to design thread-safe linked lists */
module_symbols_t symbols;
};
......@@ -98,12 +93,6 @@ struct module_t
vlc_bool_t b_builtin; /* Set to true if the module is built in */
int i_usage; /* Reference counter */
int i_unused_delay; /* Delay until module is unloaded */
module_t *next; /* Next module */
module_t *prev; /* Previous module */
/*
* Symbol table we send to the module so that it can access vlc symbols
*/
......@@ -125,8 +114,6 @@ void __module_LoadPlugins ( vlc_object_t * );
void __module_EndBank ( vlc_object_t * );
#define module_ResetBank(a) __module_ResetBank(VLC_OBJECT(a))
void __module_ResetBank ( vlc_object_t * );
#define module_ManageBank(a) __module_ManageBank(VLC_OBJECT(a))
void __module_ManageBank ( vlc_object_t * );
#define module_Need(a,b,c) __module_Need(VLC_OBJECT(a),b,c)
VLC_EXPORT( module_t *, __module_Need, ( vlc_object_t *, const char *, const char * ) );
......
......@@ -2,7 +2,7 @@
* vlc_objects.h: vlc_object_t definition.
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: vlc_objects.h,v 1.9 2002/08/14 17:06:53 sam Exp $
* $Id: vlc_objects.h,v 1.10 2002/08/15 12:11:15 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -52,7 +52,7 @@ VLC_EXPORT( void *, __vlc_object_find, ( vlc_object_t *, int, int ) );
VLC_EXPORT( void, __vlc_object_yield, ( vlc_object_t * ) );
VLC_EXPORT( void, __vlc_object_release, ( vlc_object_t * ) );
VLC_EXPORT( vlc_list_t *, __vlc_list_find, ( vlc_object_t *, int, int ) );
VLC_EXPORT( void, __vlc_list_release, ( vlc_object_t *, vlc_list_t * ) );
VLC_EXPORT( void, vlc_list_release, ( vlc_list_t * ) );
VLC_EXPORT( void, __vlc_liststructure, ( vlc_object_t * ) );
VLC_EXPORT( void, __vlc_dumpstructure, ( vlc_object_t * ) );
......@@ -82,9 +82,6 @@ VLC_EXPORT( void, __vlc_dumpstructure, ( vlc_object_t * ) );
#define vlc_list_find(a,b,c) \
__vlc_list_find( VLC_OBJECT(a),b,c)
#define vlc_list_release(a,b) \
__vlc_list_release( VLC_OBJECT(a),b )
#define vlc_liststructure(a) \
__vlc_liststructure( VLC_OBJECT(a) )
......
......@@ -93,7 +93,6 @@ struct module_symbols_t
void (* __msg_Unsubscribe_inner) ( vlc_object_t *, msg_subscription_t * ) ;
void (* __msg_Warn_inner) ( void *, const char *, ... ) ;
void (* __vlc_dumpstructure_inner) ( vlc_object_t * ) ;
void (* __vlc_list_release_inner) ( vlc_object_t *, vlc_list_t * ) ;
void (* __vlc_liststructure_inner) ( vlc_object_t * ) ;
void (* __vlc_object_attach_inner) ( vlc_object_t *, vlc_object_t * ) ;
void (* __vlc_object_destroy_inner) ( vlc_object_t * ) ;
......@@ -129,6 +128,7 @@ struct module_symbols_t
void (* mwait_inner) ( mtime_t date ) ;
void (* playlist_Command_inner) ( playlist_t *, int, int ) ;
void (* sout_DeleteInstance_inner) ( sout_instance_t * ) ;
void (* vlc_list_release_inner) ( vlc_list_t * ) ;
void (* vout_AllocatePicture_inner) ( vout_thread_t *, picture_t *, int, int, u32 ) ;
void (* vout_DatePicture_inner) ( vout_thread_t *, picture_t *, mtime_t ) ;
void (* vout_DestroyPicture_inner) ( vout_thread_t *, picture_t * ) ;
......@@ -191,7 +191,6 @@ struct module_symbols_t
# define __vlc_cond_init p_symbols->__vlc_cond_init_inner
# define __vlc_dumpstructure p_symbols->__vlc_dumpstructure_inner
# define __vlc_list_find p_symbols->__vlc_list_find_inner
# define __vlc_list_release p_symbols->__vlc_list_release_inner
# define __vlc_liststructure p_symbols->__vlc_liststructure_inner
# define __vlc_mutex_destroy p_symbols->__vlc_mutex_destroy_inner
# define __vlc_mutex_init p_symbols->__vlc_mutex_init_inner
......@@ -272,6 +271,7 @@ struct module_symbols_t
# define playlist_Command p_symbols->playlist_Command_inner
# define playlist_Delete p_symbols->playlist_Delete_inner
# define sout_DeleteInstance p_symbols->sout_DeleteInstance_inner
# define vlc_list_release p_symbols->vlc_list_release_inner
# define vout_AllocatePicture p_symbols->vout_AllocatePicture_inner
# define vout_ChromaCmp p_symbols->vout_ChromaCmp_inner
# define vout_CreatePicture p_symbols->vout_CreatePicture_inner
......
......@@ -2,7 +2,7 @@
* gtk_preferences.c: functions to handle the preferences dialog box.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: preferences.c,v 1.3 2002/08/14 17:06:53 sam Exp $
* $Id: preferences.c,v 1.4 2002/08/15 12:11:15 sam Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
* Loc Minier <lool@via.ecp.fr>
......@@ -118,7 +118,8 @@ void GtkPreferencesShow( GtkMenuItem * menuitem, gpointer user_data )
static void GtkCreateConfigDialog( char *psz_module_name,
intf_thread_t *p_intf )
{
module_t *p_module;
module_t **pp_parser;
vlc_list_t *p_list;
module_config_t *p_item;
guint rows = 0;
......@@ -173,27 +174,36 @@ static void GtkCreateConfigDialog( char *psz_module_name,
/* Look for the selected module */
for( p_module = p_intf->p_vlc->p_module_bank->first ; p_module != NULL ;
p_module = p_module->next )
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( pp_parser = (module_t **)p_list->pp_objects ;
*pp_parser ;
pp_parser++ )
{
if( psz_module_name
&& !strcmp( psz_module_name, p_module->psz_object_name ) )
&& !strcmp( psz_module_name, (*pp_parser)->psz_object_name ) )
{
break;
}
}
if( !p_module ) return;
if( !(*pp_parser) )
{
vlc_list_release( p_list );
return;
}
/* We found it, now we can start building its configuration interface */
/* Create the configuration dialog box */
#ifdef MODULE_NAME_IS_gnome
config_dialog = gnome_dialog_new( p_module->psz_longname, NULL );
config_dialog = gnome_dialog_new( (*pp_parser)->psz_longname, NULL );
config_dialog_vbox = GNOME_DIALOG(config_dialog)->vbox;
#else
config_dialog = gtk_dialog_new();
gtk_window_set_title( GTK_WINDOW(config_dialog), p_module->psz_longname );
gtk_window_set_title( GTK_WINDOW(config_dialog),
(*pp_parser)->psz_longname );
config_dialog_vbox = GTK_DIALOG(config_dialog)->vbox;
#endif
......@@ -215,8 +225,9 @@ static void GtkCreateConfigDialog( char *psz_module_name,
gtk_container_add( GTK_CONTAINER(config_dialog_vbox), config_notebook );
/* Enumerate config options and add corresponding config boxes */
p_item = p_module->p_config;
do
p_item = (*pp_parser)->p_config;
if( p_item ) do
{
switch( p_item->i_type )
{
......@@ -318,9 +329,7 @@ static void GtkCreateConfigDialog( char *psz_module_name,
/* build a list of available modules */
{
gchar * entry[2];
vlc_list_t *p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE,
FIND_ANYWHERE );
module_t **pp_parser = (module_t **)p_list->pp_objects;
pp_parser = (module_t **)p_list->pp_objects;
for( ; *pp_parser ; pp_parser++ )
{
......@@ -332,8 +341,6 @@ static void GtkCreateConfigDialog( char *psz_module_name,
gtk_clist_append( GTK_CLIST(module_clist), entry );
}
}
vlc_list_release( p_intf, p_list );
}
gtk_clist_set_column_auto_resize( GTK_CLIST(module_clist),
......@@ -508,6 +515,8 @@ static void GtkCreateConfigDialog( char *psz_module_name,
}
while( p_item->i_type != CONFIG_HINT_END && p_item++ );
vlc_list_release( p_list );
#ifndef MODULE_NAME_IS_gnome
/* Now let's add the action buttons at the bottom of the page */
dialog_action_area = GTK_DIALOG(config_dialog)->action_area;
......@@ -649,35 +658,41 @@ void GtkModuleHighlighted( GtkCList *module_clist, int row, int column,
{
intf_thread_t *p_intf;
GtkWidget *config_button;
module_t *p_module;
module_t **pp_parser;
vlc_list_t *p_list;
char *psz_name;
p_intf = (intf_thread_t *)gtk_object_get_data( GTK_OBJECT(module_clist),
"p_intf" );
if( gtk_clist_get_text( GTK_CLIST(module_clist), row, 0, &psz_name ) )
if( !gtk_clist_get_text( GTK_CLIST(module_clist), row, 0, &psz_name ) )
{
/* look for module 'psz_name' */
for( p_module = p_intf->p_vlc->p_module_bank->first ;
p_module != NULL ;
p_module = p_module->next )
return;
}
/* look for module 'psz_name' */
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( pp_parser = (module_t **)p_list->pp_objects ;
*pp_parser ;
pp_parser++ )
{
if( !strcmp( (*pp_parser)->psz_object_name, psz_name ) )
{
if( !strcmp( p_module->psz_object_name, psz_name ) )
{
gtk_object_set_data( GTK_OBJECT(module_clist),
"module_highlighted", p_module );
config_button = gtk_object_get_data( GTK_OBJECT(module_clist),
"config_button" );
if( p_module->i_config_items )
gtk_widget_set_sensitive( config_button, TRUE );
else
gtk_widget_set_sensitive( config_button, FALSE );
break;
}
}
gtk_object_set_data( GTK_OBJECT(module_clist),
"module_highlighted", (*pp_parser) );
config_button = gtk_object_get_data( GTK_OBJECT(module_clist),
"config_button" );
if( (*pp_parser)->i_config_items )
gtk_widget_set_sensitive( config_button, TRUE );
else
gtk_widget_set_sensitive( config_button, FALSE );
break;
}
}
vlc_list_release( p_list );
}
/****************************************************************************
......
......@@ -2,7 +2,7 @@
* preferences.cpp: preferences window for the kde gui
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: preferences.cpp,v 1.3 2002/08/14 17:06:53 sam Exp $
* $Id: preferences.cpp,v 1.4 2002/08/15 12:11:15 sam Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> Mon Aug 12 2002
*
......@@ -51,7 +51,6 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name,
KDialogBase ( Tabbed, caption, Ok| Apply|Cancel|User1, Ok, parent,
"vlc preferences", true, false, "Save")
{
module_t *p_module;
module_t **pp_parser;
vlc_list_t *p_list;
module_config_t *p_item;
......@@ -60,17 +59,30 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name,
this->p_intf = p_intf;
/* List all modules */
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
/* Look for the selected module */
for( p_module = p_intf->p_vlc->p_module_bank->first ; p_module != NULL ;
p_module = p_module->next )
for( pp_parser = (module_t **)p_list->pp_objects ;
*pp_parser ;
pp_parser++ )
{
if( psz_module_name && !strcmp( psz_module_name, p_module->psz_object_name ) )
if( psz_module_name
&& !strcmp( psz_module_name, (*pp_parser)->psz_object_name ) )
{
break;
}
}
if( !p_module ) return;
p_item = p_module->p_config;
do
if( !(*pp_parser) )
{
vlc_list_release( p_list );
return;
}
p_item = (*pp_parser)->p_config;
if( p_item ) do
{
switch( p_item->i_type )
{
......@@ -118,11 +130,9 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name,
/* build a list of available plugins */
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE,
FIND_ANYWHERE );
pp_parser = (module_t **)p_list->pp_objects;
for( ; *pp_parser ; pp_parser++ )
for( pp_parser = (module_t **)p_list->pp_objects ;
*pp_parser ;
pp_parser++ )
{
if( !strcmp( (*pp_parser)->psz_capability,
p_item->psz_type ) )
......@@ -132,7 +142,6 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name,
(*pp_parser)->psz_longname);
}
}
vlc_list_release( p_intf, p_list );
vlc_mutex_unlock( p_item->p_lock );
}
......@@ -221,8 +230,10 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name,
p_item++;
}
while( p_item->i_type != CONFIG_HINT_END );
vlc_list_release( p_list );
exec();
}
/*
......@@ -237,16 +248,25 @@ KPreferences::~KPreferences()
*/
bool KPreferences::isConfigureable(QString module)
{
module_t *p_module;
for( p_module = p_intf->p_vlc->p_module_bank->first ;
p_module != NULL ;
p_module = p_module->next ) {
if( !module.compare( p_module->psz_object_name ) ) {
return p_module->i_config_items != 0;
module_t **pp_parser;
vlc_list_t *p_list;
p_list = vlc_list_find( this->p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( pp_parser = (module_t **)p_list->pp_objects ;
*pp_parser ;
pp_parser++ )
{
if( !module.compare( (*pp_parser)->psz_object_name ) )
{
bool ret = (*pp_parser)->i_config_items != 0;
vlc_list_release( p_list );
return ret;
}
}
return false;
vlc_list_release( p_list );
return false;
}
/*
......
......@@ -394,7 +394,7 @@ void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )
/* Enumerate config options and add corresponding config boxes */
p_item = p_module->p_config;
do
if( p_item ) do
{
switch( p_item->i_type )
{
......@@ -438,7 +438,7 @@ void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )
}
}
vlc_list_release( p_intfGlobal, p_list );
vlc_list_release( p_list );
break;
......
......@@ -2,7 +2,7 @@
* libvlc.c: main libvlc source
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.c,v 1.25 2002/08/12 09:34:15 sam Exp $
* $Id: libvlc.c,v 1.26 2002/08/15 12:11:15 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -272,13 +272,12 @@ vlc_error_t vlc_init_r( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] )
}
p_help_module->psz_object_name = "help";
config_Duplicate( p_help_module, p_help_config );
p_help_module->next = p_vlc->p_module_bank->first;
p_vlc->p_module_bank->first = p_help_module;
vlc_object_attach( p_help_module, p_vlc->p_module_bank );
/* End hack */
if( config_LoadCmdLine( p_vlc, &i_argc, ppsz_argv, VLC_TRUE ) )
{
p_vlc->p_module_bank->first = p_help_module->next;
vlc_object_detach( p_help_module );
config_Free( p_help_module );
vlc_object_destroy( p_help_module );
module_EndBank( p_vlc );
......@@ -294,7 +293,7 @@ vlc_error_t vlc_init_r( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] )
Usage( p_vlc, "help" );
Usage( p_vlc, "main" );
p_vlc->p_module_bank->first = p_help_module->next;
vlc_object_detach( p_help_module );
config_Free( p_help_module );
vlc_object_destroy( p_help_module );
module_EndBank( p_vlc );
......@@ -306,7 +305,7 @@ vlc_error_t vlc_init_r( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] )
if( config_GetInt( p_vlc, "version" ) )
{
Version();
p_vlc->p_module_bank->first = p_help_module->next;
vlc_object_detach( p_help_module );
config_Free( p_help_module );
vlc_object_destroy( p_help_module );
module_EndBank( p_vlc );
......@@ -315,7 +314,7 @@ vlc_error_t vlc_init_r( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] )
}
/* Hack: remove the help module here */
p_vlc->p_module_bank->first = p_help_module->next;
vlc_object_detach( p_help_module );
/* End hack */
/*
......@@ -327,11 +326,10 @@ vlc_error_t vlc_init_r( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] )
module_LoadBuiltins( p_vlc );
module_LoadPlugins( p_vlc );
msg_Dbg( p_vlc, "module bank initialized, found %i modules",
p_vlc->p_module_bank->i_count );
p_vlc->p_module_bank->i_children );
/* Hack: insert the help module here */
p_help_module->next = p_vlc->p_module_bank->first;
p_vlc->p_module_bank->first = p_help_module;
vlc_object_attach( p_help_module, p_vlc->p_module_bank );
/* End hack */
/* Check for help on modules */
......@@ -339,7 +337,7 @@ vlc_error_t vlc_init_r( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] )
{
Usage( p_vlc, p_tmp );
free( p_tmp );
p_vlc->p_module_bank->first = p_help_module->next;
vlc_object_detach( p_help_module );
config_Free( p_help_module );
vlc_object_destroy( p_help_module );
module_EndBank( p_vlc );
......@@ -351,7 +349,7 @@ vlc_error_t vlc_init_r( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] )
if( config_GetInt( p_vlc, "longhelp" ) )
{
Usage( p_vlc, NULL );
p_vlc->p_module_bank->first = p_help_module->next;
vlc_object_detach( p_help_module );
config_Free( p_help_module );
vlc_object_destroy( p_help_module );
module_EndBank( p_vlc );
......@@ -363,7 +361,7 @@ vlc_error_t vlc_init_r( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] )
if( config_GetInt( p_vlc, "list" ) )
{
ListModules( p_vlc );
p_vlc->p_module_bank->first = p_help_module->next;
vlc_object_detach( p_help_module );
config_Free( p_help_module );
vlc_object_destroy( p_help_module );
module_EndBank( p_vlc );
......@@ -372,7 +370,7 @@ vlc_error_t vlc_init_r( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] )
}
/* Hack: remove the help module here */
p_vlc->p_module_bank->first = p_help_module->next;
vlc_object_detach( p_help_module );
config_Free( p_help_module );
vlc_object_destroy( p_help_module );
/* End hack */
......@@ -902,7 +900,8 @@ static void Usage( vlc_t *p_this, const char *psz_module_name )
*/
#define LINE_START 8
#define PADDING_SPACES 25
module_t *p_module;
vlc_list_t *p_list;
module_t **pp_parser;
module_config_t *p_item;
char psz_spaces[PADDING_SPACES+LINE_START+1];
char psz_format[sizeof(FORMAT_STRING)];
......@@ -916,30 +915,34 @@ static void Usage( vlc_t *p_this, const char *psz_module_name )
ShowConsole();
#endif
/* List all modules */
p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
/* Enumerate the config for each module */
for( p_module = p_this->p_vlc->p_module_bank->first ;
p_module != NULL ;
p_module = p_module->next )
for( pp_parser = (module_t **)p_list->pp_objects ;
*pp_parser ;
pp_parser++ )
{
vlc_bool_t b_help_module = !strcmp( "help", p_module->psz_object_name );
vlc_bool_t b_help_module =
!strcmp( "help", (*pp_parser)->psz_object_name );
if( psz_module_name && strcmp( psz_module_name,
p_module->psz_object_name ) )
(*pp_parser)->psz_object_name ) )
{
continue;
}
/* Ignore modules without config options */
if( !p_module->i_config_items )
if( !(*pp_parser)->i_config_items )
{
continue;
}
/* Print module name */
fprintf( stderr, _("%s module options:\n\n"),
p_module->psz_object_name );
(*pp_parser)->psz_object_name );
for( p_item = p_module->p_config;
for( p_item = (*pp_parser)->p_config;
p_item->i_type != CONFIG_HINT_END;
p_item++ )
{
......@@ -1072,6 +1075,9 @@ static void Usage( vlc_t *p_this, const char *psz_module_name )
}
/* Release the module list */
vlc_list_release( p_list );
#ifdef WIN32 /* Pause the console because it's destroyed when we exit */
fprintf( stderr, _("\nPress the RETURN key to continue...\n") );
getchar();
......@@ -1086,7 +1092,8 @@ static void Usage( vlc_t *p_this, const char *psz_module_name )
*****************************************************************************/
static void ListModules( vlc_t *p_this )
{
module_t *p_module;
vlc_list_t *p_list;
module_t **pp_parser;
char psz_spaces[22];
memset( psz_spaces, ' ', 22 );
......@@ -1101,24 +1108,26 @@ static void ListModules( vlc_t *p_this )
fprintf( stderr, _("[module] [description]\n") );
/* List all modules */
p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
/* Enumerate each module */
for( p_module = p_this->p_vlc->p_module_bank->first ;
p_module != NULL ;
p_module = p_module->next )
for( pp_parser = (module_t **)p_list->pp_objects ;
*pp_parser ;
pp_parser++ )
{
int i;
/* Nasty hack, but right now I'm too tired to think about a nice
* solution */
i = 22 - strlen( p_module->psz_object_name ) - 1;
i = 22 - strlen( (*pp_parser)->psz_object_name ) - 1;
if( i < 0 ) i = 0;
psz_spaces[i] = 0;
fprintf( stderr, " %s%s %s\n", p_module->psz_object_name, psz_spaces,
p_module->psz_longname );
fprintf( stderr, " %s%s %s\n", (*pp_parser)->psz_object_name,
psz_spaces, (*pp_parser)->psz_longname );
psz_spaces[i] = ' ';
}
#ifdef WIN32 /* Pause the console because it's destroyed when we exit */
......
This diff is collapsed.
This diff is collapsed.
......@@ -304,7 +304,7 @@ static const char * module_error( char *psz_buffer )
(p_symbols)->__vlc_object_yield_inner = __vlc_object_yield; \
(p_symbols)->__vlc_object_release_inner = __vlc_object_release; \
(p_symbols)->__vlc_list_find_inner = __vlc_list_find; \
(p_symbols)->__vlc_list_release_inner = __vlc_list_release; \
(p_symbols)->vlc_list_release_inner = vlc_list_release; \
(p_symbols)->__vlc_liststructure_inner = __vlc_liststructure; \
(p_symbols)->__vlc_dumpstructure_inner = __vlc_dumpstructure; \
(p_symbols)->playlist_Command_inner = playlist_Command; \
......
......@@ -2,7 +2,7 @@
* objects.c: vlc_object_t handling
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: objects.c,v 1.18 2002/08/14 17:06:53 sam Exp $
* $Id: objects.c,v 1.19 2002/08/15 12:11:15 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -410,9 +410,8 @@ vlc_list_t * __vlc_list_find( vlc_object_t *p_this, int i_type, int i_mode )
/*****************************************************************************
* vlc_liststructure: print the current vlc objects
*****************************************************************************
* This function prints an ASCII tree showing the connections between vlc
* objects, and additional information such as their refcount, thread ID,
* address, etc.
* This function prints alist of vlc objects, and additional information such
* as their refcount, thread ID, etc.
*****************************************************************************/
void __vlc_liststructure( vlc_object_t *p_this )
{
......@@ -444,8 +443,7 @@ void __vlc_liststructure( vlc_object_t *p_this )
* vlc_dumpstructure: print the current vlc structure
*****************************************************************************
* This function prints an ASCII tree showing the connections between vlc
* objects, and additional information such as their refcount, thread ID,
* address, etc.
* objects, and additional information such as their refcount, thread ID, etc.
*****************************************************************************/
void __vlc_dumpstructure( vlc_object_t *p_this )
{
......@@ -463,19 +461,23 @@ void __vlc_dumpstructure( vlc_object_t *p_this )
* This function decreases the refcount of all objects in the list and
* frees the list.
*****************************************************************************/
void __vlc_list_release( vlc_object_t *p_this, vlc_list_t *p_list )
void vlc_list_release( vlc_list_t *p_list )
{
vlc_object_t **p_current = p_list->pp_objects;
if( p_list->i_count )
{
vlc_t * p_vlc = p_list->pp_objects[0]->p_vlc;
vlc_object_t ** pp_current = p_list->pp_objects;
vlc_mutex_lock( &p_this->p_vlc->structure_lock );
vlc_mutex_lock( &p_vlc->structure_lock );
while( p_current[0] )
{
p_current[0]->i_refcount--;
p_current++;
}
while( pp_current[0] )
{
pp_current[0]->i_refcount--;
pp_current++;
}
vlc_mutex_unlock( &p_this->p_vlc->structure_lock );
vlc_mutex_unlock( &p_vlc->structure_lock );
}
free( p_list );
}
......
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