to use this new type.
* variables.h: variables handling
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: variables.h,v 1.9 2002/12/07 15:25:26 gbazin Exp $
+ * $Id: variables.h,v 1.10 2002/12/13 01:56:29 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
#define VLC_VAR_HASMAX 0x0400
#define VLC_VAR_HASSTEP 0x0800
-#define VLC_VAR_ISCOMMAND 0x1000
+#define VLC_VAR_ISLIST 0x1000
+#define VLC_VAR_ISCOMMAND 0x2000
+#define VLC_VAR_ISCONFIG 0x2000
/*****************************************************************************
* Variable actions
* vlc.h: global header for vlc
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: vlc.h,v 1.18 2002/12/03 16:29:04 gitan Exp $
+ * $Id: vlc.h,v 1.19 2002/12/13 01:56:29 gbazin Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* Our custom types
*****************************************************************************/
typedef int vlc_bool_t;
+typedef struct vlc_list_t vlc_list_t;
+typedef struct vlc_object_t vlc_object_t;
typedef union
{
- int i_int;
- vlc_bool_t b_bool;
- float f_float;
- char * psz_string;
- void * p_address;
+ int i_int;
+ vlc_bool_t b_bool;
+ float f_float;
+ char * psz_string;
+ void * p_address;
+ vlc_object_t * p_object;
/* Make sure the structure is at least 64bits */
struct { char a, b, c, d, e, f, g, h; } padding;
} vlc_value_t;
+struct vlc_list_t
+{
+ int i_count;
+ vlc_value_t * p_values;
+
+};
+
/*****************************************************************************
* Error values
*****************************************************************************/
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: vlc_common.h,v 1.42 2002/11/28 23:24:14 massiot Exp $
+ * $Id: vlc_common.h,v 1.43 2002/12/13 01:56:29 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
/* Internal types */
typedef struct libvlc_t libvlc_t;
typedef struct vlc_t vlc_t;
-typedef struct vlc_list_t vlc_list_t;
-typedef struct vlc_object_t vlc_object_t;
typedef struct variable_t variable_t;
/* Messages */
* vlc_objects.h: vlc_object_t definition.
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: vlc_objects.h,v 1.13 2002/10/14 16:46:55 sam Exp $
+ * $Id: vlc_objects.h,v 1.14 2002/12/13 01:56:29 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
VLC_COMMON_MEMBERS
};
-/*****************************************************************************
- * The vlc_list_t object list type
- *****************************************************************************/
-struct vlc_list_t
-{
- int i_count;
- vlc_object_t ** pp_objects;
-
- /* Private */
- int _i_extra;
- vlc_object_t * _p_first;
-};
-
/*****************************************************************************
* Prototypes
*****************************************************************************/
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( vlc_list_t, __vlc_list_find, ( vlc_object_t *, int, int ) );
VLC_EXPORT( void, vlc_list_release, ( vlc_list_t * ) );
#define vlc_object_create(a,b) \
* familiar.c : familiar plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: familiar.c,v 1.12 2002/12/12 12:24:23 sam Exp $
+ * $Id: familiar.c,v 1.13 2002/12/13 01:56:29 gbazin Exp $
*
* Authors: Jean-Paul Saman <jpsaman@wxs.nl>
*
void GtkAutoPlayFile( vlc_object_t *p_this )
{
GtkWidget *cbautoplay;
- intf_thread_t **pp_intf;
- vlc_list_t *p_list = vlc_list_find( p_this, VLC_OBJECT_INTF,
+ intf_thread_t *p_intf;
+ int i_index;
+ vlc_list_t list = vlc_list_find( p_this, VLC_OBJECT_INTF,
FIND_ANYWHERE );
- for( pp_intf = (intf_thread_t **)p_list->pp_objects ;
- *pp_intf ;
- pp_intf++ )
+ for( i_index = 0; i_index < list.i_count; i_index++ )
{
- if( strcmp( MODULE_STRING, (*pp_intf)->p_module->psz_object_name ) )
+ p_intf = (intf_thread_t *)list.p_values[i_index].p_object ;
+
+ if( strcmp( MODULE_STRING, p_intf->p_module->psz_object_name ) )
{
continue;
}
cbautoplay = GTK_WIDGET( gtk_object_get_data(
- GTK_OBJECT( (*pp_intf)->p_sys->p_window ),
+ GTK_OBJECT( p_intf->p_sys->p_window ),
"cbautoplay" ) );
if( !config_GetInt( p_this, "familiar-autoplayfile" ) )
{
- (*pp_intf)->p_sys->b_autoplayfile = VLC_FALSE;
+ p_intf->p_sys->b_autoplayfile = VLC_FALSE;
}
else
{
- (*pp_intf)->p_sys->b_autoplayfile = VLC_TRUE;
+ p_intf->p_sys->b_autoplayfile = VLC_TRUE;
}
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( cbautoplay ),
- (*pp_intf)->p_sys->b_autoplayfile );
+ p_intf->p_sys->b_autoplayfile );
}
- vlc_list_release( p_list );
+ vlc_list_release( &list );
}
* display.c: Gtk+ tools for main interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: display.c,v 1.4 2002/09/30 11:05:38 sam Exp $
+ * $Id: display.c,v 1.5 2002/12/13 01:56:29 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>
*****************************************************************************/
void E_(GtkHideTooltips)( vlc_object_t *p_this )
{
- intf_thread_t **pp_intf;
- vlc_list_t *p_list = vlc_list_find( p_this, VLC_OBJECT_INTF,
- FIND_ANYWHERE );
+ intf_thread_t *p_intf;
+ int i_index;
+ vlc_list_t list = vlc_list_find( p_this, VLC_OBJECT_INTF,
+ FIND_ANYWHERE );
vlc_bool_t b_enable = config_GetInt( p_this, "gnome-tooltips" );
- for( pp_intf = (intf_thread_t **)p_list->pp_objects ;
- *pp_intf ;
- pp_intf++ )
+ for( i_index = 0; i_index < list.i_count; i_index++ )
{
- if( strcmp( MODULE_STRING, (*pp_intf)->p_module->psz_object_name ) )
+ p_intf = (intf_thread_t *)list.p_values[i_index].p_object ;
+
+ if( strcmp( MODULE_STRING, p_intf->p_module->psz_object_name ) )
{
continue;
}
if( b_enable )
{
- gtk_tooltips_enable( (*pp_intf)->p_sys->p_tooltips );
+ gtk_tooltips_enable( p_intf->p_sys->p_tooltips );
}
else
{
- gtk_tooltips_disable( (*pp_intf)->p_sys->p_tooltips );
+ gtk_tooltips_disable( p_intf->p_sys->p_tooltips );
}
}
- vlc_list_release( p_list );
+ vlc_list_release( &list );
}
#ifdef MODULE_NAME_IS_gnome
{
GtkToolbarStyle style;
GtkToolbar * p_toolbar;
- intf_thread_t **pp_intf;
- vlc_list_t *p_list = vlc_list_find( p_this, VLC_OBJECT_INTF,
- FIND_ANYWHERE );
+ intf_thread_t *p_intf;
+ int i_index;
+ vlc_list_t list = vlc_list_find( p_this, VLC_OBJECT_INTF,
+ FIND_ANYWHERE );
style = config_GetInt( p_this, "gnome-toolbartext" )
? GTK_TOOLBAR_BOTH
: GTK_TOOLBAR_ICONS;
- for( pp_intf = (intf_thread_t **)p_list->pp_objects ;
- *pp_intf ;
- pp_intf++ )
+ for( i_index = 0; i_index < list.i_count; i_index++ )
{
- if( strcmp( MODULE_STRING, (*pp_intf)->p_module->psz_object_name ) )
+ p_intf = (module_t *)list.p_values[i_index].p_object ;
+
+ if( strcmp( MODULE_STRING, p_intf->p_module->psz_object_name ) )
{
continue;
}
- p_toolbar = GTK_TOOLBAR(lookup_widget( (*pp_intf)->p_sys->p_window,
+ p_toolbar = GTK_TOOLBAR(lookup_widget( p_intf->p_sys->p_window,
"toolbar" ));
gtk_toolbar_set_style( p_toolbar, style );
}
- vlc_list_release( p_list );
+ vlc_list_release( &list );
}
#endif
* gtk_preferences.c: functions to handle the preferences dialog box.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
- * $Id: preferences.c,v 1.5 2002/12/06 16:34:07 sam Exp $
+ * $Id: preferences.c,v 1.6 2002/12/13 01:56:29 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
* Loïc Minier <lool@via.ecp.fr>
static void GtkCreateConfigDialog( char *psz_module_name,
intf_thread_t *p_intf )
{
- module_t **pp_parser;
- vlc_list_t *p_list;
+ module_t *p_parser = NULL;
+ vlc_list_t list;
module_config_t *p_item;
+ int i_index;
guint rows = 0;
/* Look for the selected module */
- p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
+ list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
- for( pp_parser = (module_t **)p_list->pp_objects ;
- *pp_parser ;
- pp_parser++ )
+ for( i_index = 0; i_index < list.i_count; i_index++ )
{
+ p_parser = (module_t *)list.p_values[i_index].p_object ;
if( psz_module_name
- && !strcmp( psz_module_name, (*pp_parser)->psz_object_name ) )
+ && !strcmp( psz_module_name, p_parser->psz_object_name ) )
{
break;
}
}
- if( !(*pp_parser) )
+ if( !p_parser || i_index == list.i_count )
{
- vlc_list_release( p_list );
+ vlc_list_release( &list );
return;
}
/* Create the configuration dialog box */
#ifdef MODULE_NAME_IS_gnome
- config_dialog = gnome_dialog_new( (*pp_parser)->psz_longname, NULL );
+ config_dialog = gnome_dialog_new( p_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),
- (*pp_parser)->psz_longname );
+ p_parser->psz_longname );
config_dialog_vbox = GTK_DIALOG(config_dialog)->vbox;
#endif
gtk_container_add( GTK_CONTAINER(config_dialog_vbox), config_notebook );
/* Enumerate config options and add corresponding config boxes */
- p_item = (*pp_parser)->p_config;
+ p_item = p_parser->p_config;
if( p_item ) do
{
/* build a list of available modules */
{
gchar * entry[2];
- pp_parser = (module_t **)p_list->pp_objects;
- for( ; *pp_parser ; pp_parser++ )
+ for( i_index = 0; i_index < list.i_count; i_index++ )
{
- if( !strcmp( (*pp_parser)->psz_capability,
+ p_parser = (module_t *)list.p_values[i_index].p_object ;
+
+ if( !strcmp( p_parser->psz_capability,
p_item->psz_type ) )
{
- entry[0] = (*pp_parser)->psz_object_name;
- entry[1] = (*pp_parser)->psz_longname;
+ entry[0] = p_parser->psz_object_name;
+ entry[1] = p_parser->psz_longname;
gtk_clist_append( GTK_CLIST(module_clist), entry );
}
}
}
while( p_item->i_type != CONFIG_HINT_END && p_item++ );
- vlc_list_release( p_list );
+ vlc_list_release( &list );
#ifndef MODULE_NAME_IS_gnome
/* Now let's add the action buttons at the bottom of the page */
{
intf_thread_t *p_intf;
GtkWidget *config_button;
- module_t **pp_parser;
- vlc_list_t *p_list;
+ module_t *p_parser;
+ vlc_list_t list;
char *psz_name;
+ int i_index;
p_intf = (intf_thread_t *)gtk_object_get_data( GTK_OBJECT(module_clist),
"p_intf" );
}
/* look for module 'psz_name' */
- p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
+ list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
- for( pp_parser = (module_t **)p_list->pp_objects ;
- *pp_parser ;
- pp_parser++ )
+ for( i_index = 0; i_index < list.i_count; i_index++ )
{
- if( !strcmp( (*pp_parser)->psz_object_name, psz_name ) )
+ p_parser = (module_t *)list.p_values[i_index].p_object ;
+
+ if( !strcmp( p_parser->psz_object_name, psz_name ) )
{
gtk_object_set_data( GTK_OBJECT(module_clist),
- "module_highlighted", (*pp_parser) );
+ "module_highlighted", p_parser );
config_button = gtk_object_get_data( GTK_OBJECT(module_clist),
"config_button" );
- if( (*pp_parser)->i_config_items )
+ if( p_parser->i_config_items )
gtk_widget_set_sensitive( config_button, TRUE );
else
gtk_widget_set_sensitive( config_button, FALSE );
}
}
- vlc_list_release( p_list );
+ vlc_list_release( &list );
}
/****************************************************************************
* preferences.cpp: preferences window for the kde gui
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: preferences.cpp,v 1.8 2002/10/16 23:34:27 sigmunau Exp $
+ * $Id: preferences.cpp,v 1.9 2002/12/13 01:56:29 gbazin Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> Mon Aug 12 2002
*
KDialogBase ( Tabbed, caption, Ok| Apply|Cancel|User1, Ok, parent,
"vlc preferences", true, false, "Save")
{
- module_t **pp_parser;
- vlc_list_t *p_list;
+ module_t *p_parser;
+ vlc_list_t list;
module_config_t *p_item;
+ int i_index;
QVBox *category_table = NULL;
QString *category_label;
this->p_intf = p_intf;
/* List all modules */
- p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
+ list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
/* Look for the selected module */
- for( pp_parser = (module_t **)p_list->pp_objects ;
- *pp_parser ;
- pp_parser++ )
+ for( i_index = 0; i_index < list.i_count; i_index++ )
{
+ p_parser = (module_t *)list.p_values[i_index].p_object ;
if( psz_module_name
- && !strcmp( psz_module_name, (*pp_parser)->psz_object_name ) )
+ && !strcmp( psz_module_name, p_parser->psz_object_name ) )
{
break;
}
}
- if( !(*pp_parser) )
+ if( !p_parser || i_index == list.i_count )
{
- vlc_list_release( p_list );
+ vlc_list_release( list );
return;
}
- p_item = (*pp_parser)->p_config;
+ p_item = p_parser->p_config;
if( p_item ) do
{
switch( p_item->i_type )
connect(item_frame, SIGNAL(selectionChanged(const QString &)),
ci, SLOT(setValue(const QString &)));
-
+
/* build a list of available plugins */
- for( pp_parser = (module_t **)p_list->pp_objects ;
- *pp_parser ;
- pp_parser++ )
+ for( i_index = 0; i_index < list.i_count; i_index++ )
{
- if( !strcmp( (*pp_parser)->psz_capability,
+ p_parser = (module_t *)list.p_values[i_index].p_object ;
+
+ if( !strcmp( p_parser->psz_capability,
p_item->psz_type ) )
{
new QListViewItem(item_frame->getListView(),
- (*pp_parser)->psz_object_name,
- (*pp_parser)->psz_longname);
+ p_parser->psz_object_name,
+ p_parser->psz_longname);
}
}
}
while( p_item->i_type != CONFIG_HINT_END );
- vlc_list_release( p_list );
+ vlc_list_release( &list );
exec();
}
*/
bool KPreferences::isConfigureable(QString module)
{
- module_t **pp_parser;
- vlc_list_t *p_list;
+ module_t *p_parser;
+ vlc_list_t list;
+ int i_index;
- p_list = vlc_list_find( this->p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
+ 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++ )
+ for( i_index = 0; i_index < list.i_count; i_index++ )
{
- if( !module.compare( (*pp_parser)->psz_object_name ) )
+ p_parser = (module_t *)list.p_values[i_index].p_object ;
+
+ if( !module.compare( p_parser->psz_object_name ) )
{
- bool ret = (*pp_parser)->i_config_items != 0;
- vlc_list_release( p_list );
+ bool ret = p_parser->i_config_items != 0;
+ vlc_list_release( &list );
return ret;
}
}
- vlc_list_release( p_list );
+ vlc_list_release( &list );
return false;
}
* prefs.m: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: prefs.m,v 1.1 2002/11/05 03:57:16 jlj Exp $
+ * $Id: prefs.m,v 1.2 2002/12/13 01:56:30 gbazin Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
*
- (BOOL)hasPrefs:(NSString *)o_module_name
{
- module_t **pp_parser;
- vlc_list_t *p_list;
+ module_t *p_parser;
+ vlc_list_t list;
char *psz_module_name;
+ int i_index;
psz_module_name = (char *)[o_module_name lossyCString];
/* look for module */
- p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
+ list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
- for( pp_parser = (module_t **)p_list->pp_objects ;
- *pp_parser ;
- pp_parser++ )
+ for( i_index = 0; i_index < list.i_count; i_index++ )
{
- if( !strcmp( (*pp_parser)->psz_object_name, psz_module_name ) )
+ p_parser = (module_t *)list.p_values[i_index].p_object ;
+
+ if( !strcmp( p_parser->psz_object_name, psz_module_name ) )
{
- BOOL b_has_prefs = (*pp_parser)->i_config_items != 0;
- vlc_list_release( p_list );
+ BOOL b_has_prefs = p_parser->i_config_items != 0;
+ vlc_list_release( &list );
return( b_has_prefs );
}
}
- vlc_list_release( p_list );
+ vlc_list_release( &list );
return( NO );
}
int i_pos;
int i_module_tag;
- module_t **pp_parser;
- vlc_list_t *p_list;
+ module_t *p_parser;
+ vlc_list_t list;
module_config_t *p_item;
char *psz_module_name;
+ int i_index;
NSPanel *o_panel; /* panel */
NSRect s_panel_rc; /* panel rect */
psz_module_name = (char *)[o_module_name lossyCString];
/* Look for the selected module */
- p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
+ list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
- for( pp_parser = (module_t **)p_list->pp_objects ;
- *pp_parser ;
- pp_parser++ )
+ for( i_index = 0; i_index < list.i_count; i_index++ )
{
+ p_parser = (module_t *)list.p_values[i_index].p_object ;
+
if( psz_module_name
- && !strcmp( psz_module_name, (*pp_parser)->psz_object_name ) )
+ && !strcmp( psz_module_name, p_parser->psz_object_name ) )
{
break;
}
}
- if( !(*pp_parser) )
+ if( !p_parser || i_index == list.i_count )
{
- vlc_list_release( p_list );
+ vlc_list_release( &list );
return;
}
forKey: o_module_name];
/* Enumerate config options and add corresponding config boxes */
- p_item = (*pp_parser)->p_config;
+ p_item = p_parser->p_config;
i_pos = 0;
o_view = nil;
/* build a list of available modules */
{
- pp_parser = (module_t **)p_list->pp_objects;
-
- for( ; *pp_parser ; pp_parser++ )
+ for( i_index = 0; i_index < list.i_count; i_index++ )
{
- if( !strcmp( (*pp_parser)->psz_capability,
+ p_parser = (module_t *)list.p_values[i_index].p_object ;
+
+ if( !strcmp( p_parser->psz_capability,
p_item->psz_type ) )
{
NSString *o_object_name = [NSString
- stringWithCString: (*pp_parser)->psz_object_name];
+ stringWithCString: p_parser->psz_object_name];
[o_modules addItemWithTitle: o_object_name];
}
}
}
while( p_item->i_type != CONFIG_HINT_END && p_item++ );
- vlc_list_release( p_list );
+ vlc_list_release( &list );
[o_toolbars setObject: o_tb_items forKey: o_module_name];
[o_toolbar setDelegate: self];
//---------------------------------------------------------------------------\r
void __fastcall TPanelPlugin::CheckListBoxClick( TObject *Sender )\r
{\r
- module_t **pp_parser;\r
- vlc_list_t *p_list;\r
+ module_t *p_parser;\r
+ vlc_list_t list;\r
+ int i_index;\r
\r
/* check that the click is valid (we are on an item, and the click\r
* started on an item */\r
return;\r
\r
/* look for module 'Name' */\r
- p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );\r
+ list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );\r
\r
- for( pp_parser = (module_t **)p_list->pp_objects ;\r
- *pp_parser ;\r
- pp_parser++ )\r
+ for( i_index = 0; i_index < list.i_count; i_index++ )\r
{\r
- if( strcmp( (*pp_parser)->psz_object_name, Name.c_str() ) == 0 )\r
+ p_parser = (module_t *)list.p_values[i_index].p_object ;\r
+\r
+ if( strcmp( p_parser->psz_object_name, Name.c_str() ) == 0 )\r
{\r
- ModuleSelected = (*pp_parser);\r
+ ModuleSelected = p_parser;\r
ButtonConfig->Enabled =\r
- (*pp_parser)->i_config_items ? true : false;\r
+ p_parser->i_config_items ? true : false;\r
\r
break;\r
}\r
\r
void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )\r
{\r
- module_t **pp_parser;\r
- vlc_list_t *p_list;\r
+ module_t *p_parser;\r
+ vlc_list_t list;\r
+ int i_index;\r
\r
module_config_t *p_item;\r
int i_pages, i_ctrl;\r
TPanelBool *PanelBool;\r
\r
/* Look for the selected module */\r
- p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );\r
+ list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );\r
\r
- for( pp_parser = (module_t **)p_list->pp_objects ;\r
- *pp_parser ;\r
- pp_parser++ )\r
+ for( i_index = 0; i_index < list.i_count; i_index++ )\r
{\r
+ p_parser = (module_t *)list.p_values[i_index].p_object ;\r
+\r
if( psz_module_name\r
- && !strcmp( psz_module_name, (*pp_parser)->psz_object_name ) )\r
+ && !strcmp( psz_module_name, p_parser->psz_object_name ) )\r
{\r
break;\r
}\r
}\r
- if( !(*pp_parser) )\r
+ if( !p_parser || i_index == list.i_count )\r
{\r
- vlc_list_release( p_list );\r
+ vlc_list_release( &list );\r
return;\r
}\r
\r
*/\r
\r
/* Enumerate config options and add corresponding config boxes */\r
- p_item = (*pp_parser)->p_config;\r
+ p_item = p_parser->p_config;\r
if( p_item ) do\r
{\r
switch( p_item->i_type )\r
PanelPlugin->Parent = ScrollBox;\r
\r
/* Look for valid modules */\r
- pp_parser = (module_t **)p_list->pp_objects;\r
-\r
- for( ; *pp_parser ; pp_parser++ )\r
+ for( i_index = 0; i_index < list.i_count; i_index++ )\r
{\r
- if( !strcmp( (*pp_parser)->psz_capability, p_item->psz_type ) )\r
+ p_parser = (module_t *)list.p_values[i_index].p_object ;\r
+\r
+ if( !strcmp( p_parser->psz_capability, p_item->psz_type ) )\r
{\r
AnsiString ModuleDesc;\r
- if ( (*pp_parser)->psz_longname != NULL ) {\r
- ModuleDesc = AnsiString((*pp_parser)->psz_longname) +\r
- " (" + AnsiString((*pp_parser)->psz_object_name) +\r
+ if ( p_parser->psz_longname != NULL ) {\r
+ ModuleDesc = AnsiString(p_parser->psz_longname) +\r
+ " (" + AnsiString(p_parser->psz_object_name) +\r
")";\r
}\r
else\r
- ModuleDesc = AnsiString((*pp_parser)->psz_object_name);\r
+ ModuleDesc = AnsiString(p_parser->psz_object_name);\r
\r
int item = PanelPlugin->CleanCheckListBox->Items->AddObject(\r
ModuleDesc.c_str(),\r
- new TObjectString((*pp_parser)->psz_object_name) );\r
+ new TObjectString(p_parser->psz_object_name) );\r
\r
/* check the box if it's the default module */\r
AnsiString Name = p_item->psz_value ?\r
p_item->psz_value : "";\r
- if( !strcmp( (*pp_parser)->psz_object_name, Name.c_str()) )\r
+ if( !strcmp( p_parser->psz_object_name, Name.c_str()) )\r
{\r
PanelPlugin->CleanCheckListBox->Checked[item] = true;\r
}\r
}\r
}\r
\r
- vlc_list_release( p_list );\r
+ vlc_list_release( &list );\r
\r
/* set active tabsheet\r
* FIXME: i don't know why, but both lines are necessary */\r
* libvlc.c: main libvlc source
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
- * $Id: libvlc.c,v 1.50 2002/12/08 00:41:06 massiot Exp $
+ * $Id: libvlc.c,v 1.51 2002/12/13 01:56:30 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
*/
#define LINE_START 8
#define PADDING_SPACES 25
- vlc_list_t *p_list;
- module_t **pp_parser;
+ vlc_list_t list;
+ module_t *p_parser;
module_config_t *p_item;
char psz_spaces[PADDING_SPACES+LINE_START+1];
char psz_format[sizeof(FORMAT_STRING)];
+ int i_index;
memset( psz_spaces, ' ', PADDING_SPACES+LINE_START );
psz_spaces[PADDING_SPACES+LINE_START] = '\0';
#endif
/* List all modules */
- p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
+ list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
/* Enumerate the config for each module */
- for( pp_parser = (module_t **)p_list->pp_objects ;
- *pp_parser ;
- pp_parser++ )
+ for( i_index = 0; i_index < list.i_count; i_index++ )
{
vlc_bool_t b_help_module;
+ p_parser = (module_t *)list.p_values[i_index].p_object ;
+
if( psz_module_name && strcmp( psz_module_name,
- (*pp_parser)->psz_object_name ) )
+ p_parser->psz_object_name ) )
{
continue;
}
/* Ignore modules without config options */
- if( !(*pp_parser)->i_config_items )
+ if( !p_parser->i_config_items )
{
continue;
}
- b_help_module = !strcmp( "help", (*pp_parser)->psz_object_name );
+ b_help_module = !strcmp( "help", p_parser->psz_object_name );
/* Print module options */
- for( p_item = (*pp_parser)->p_config;
+ for( p_item = p_parser->p_config;
p_item->i_type != CONFIG_HINT_END;
p_item++ )
{
}
/* Release the module list */
- vlc_list_release( p_list );
+ vlc_list_release( &list );
#ifdef WIN32 /* Pause the console because it's destroyed when we exit */
fprintf( stdout, _("\nPress the RETURN key to continue...\n") );
*****************************************************************************/
static void ListModules( vlc_t *p_this )
{
- vlc_list_t *p_list;
- module_t **pp_parser;
+ vlc_list_t list;
+ module_t *p_parser;
char psz_spaces[22];
+ int i_index;
memset( psz_spaces, ' ', 22 );
fprintf( stdout, _("[module] [description]\n") );
/* List all modules */
- p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
+ list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
/* Enumerate each module */
- for( pp_parser = (module_t **)p_list->pp_objects ;
- *pp_parser ;
- pp_parser++ )
+ for( i_index = 0; i_index < list.i_count; i_index++ )
{
int i;
+ p_parser = (module_t *)list.p_values[i_index].p_object ;
+
/* Nasty hack, but right now I'm too tired to think about a nice
* solution */
- i = 22 - strlen( (*pp_parser)->psz_object_name ) - 1;
+ i = 22 - strlen( p_parser->psz_object_name ) - 1;
if( i < 0 ) i = 0;
psz_spaces[i] = 0;
- fprintf( stdout, " %s%s %s\n", (*pp_parser)->psz_object_name,
- psz_spaces, (*pp_parser)->psz_longname );
+ fprintf( stdout, " %s%s %s\n", p_parser->psz_object_name,
+ psz_spaces, p_parser->psz_longname );
psz_spaces[i] = ' ';
}
- vlc_list_release( p_list );
+ vlc_list_release( &list );
#ifdef WIN32 /* Pause the console because it's destroyed when we exit */
fprintf( stdout, _("\nPress the RETURN key to continue...\n") );
return;
}
#endif
-
* configuration.c management of the modules configuration
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: configuration.c,v 1.46 2002/11/13 20:51:05 sam Exp $
+ * $Id: configuration.c,v 1.47 2002/12/13 01:56:30 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
*****************************************************************************/
module_config_t *config_FindConfig( vlc_object_t *p_this, const char *psz_name )
{
- vlc_list_t *p_list;
- module_t **pp_parser;
+ vlc_list_t list;
+ module_t *p_parser;
module_config_t *p_item;
+ int i_index;
if( !psz_name ) return NULL;
- p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
+ list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
- for( pp_parser = (module_t **)p_list->pp_objects ;
- *pp_parser ;
- pp_parser++ )
+ for( i_index = 0; i_index < list.i_count; i_index++ )
{
- if( !(*pp_parser)->i_config_items )
+ p_parser = (module_t *)list.p_values[i_index].p_object ;
+
+ if( !p_parser->i_config_items )
continue;
- for( p_item = (*pp_parser)->p_config;
+ for( p_item = p_parser->p_config;
p_item->i_type != CONFIG_HINT_END;
p_item++ )
{
continue;
if( !strcmp( psz_name, p_item->psz_name ) )
{
- vlc_list_release( p_list );
+ vlc_list_release( &list );
return p_item;
}
}
}
- vlc_list_release( p_list );
+ vlc_list_release( &list );
return NULL;
}
free( p_item->psz_value );
if( p_item->ppsz_list )
- {
- for( i = 0; p_item->ppsz_list[i]; i++ )
- free(p_item->ppsz_list[i]);
- free( p_item->ppsz_list );
- }
+ {
+ for( i = 0; p_item->ppsz_list[i]; i++ )
+ free(p_item->ppsz_list[i]);
+ free( p_item->ppsz_list );
+ }
}
free( p_module->p_config );
*****************************************************************************/
int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name )
{
- vlc_list_t *p_list;
- module_t **pp_parser;
+ vlc_list_t list;
+ module_t *p_parser;
module_config_t *p_item;
FILE *file;
char line[1024];
char *p_index, *psz_option_name, *psz_option_value;
char *psz_filename, *psz_homedir;
+ int i_index;
psz_homedir = p_this->p_vlc->psz_homedir;
if( !psz_homedir )
}
/* Look for the selected module, if NULL then save everything */
- p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
+ list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
- for( pp_parser = (module_t **)p_list->pp_objects ;
- *pp_parser ;
- pp_parser++ )
+ for( i_index = 0; i_index < list.i_count; i_index++ )
{
+ p_parser = (module_t *)list.p_values[i_index].p_object ;
if( psz_module_name
- && strcmp( psz_module_name, (*pp_parser)->psz_object_name ) )
+ && strcmp( psz_module_name, p_parser->psz_object_name ) )
{
continue;
}
if( (line[0] == '[')
&& (p_index = strchr(line,']'))
&& (p_index - &line[1]
- == (int)strlen((*pp_parser)->psz_object_name))
- && !memcmp( &line[1], (*pp_parser)->psz_object_name,
- strlen((*pp_parser)->psz_object_name) ) )
+ == (int)strlen(p_parser->psz_object_name))
+ && !memcmp( &line[1], p_parser->psz_object_name,
+ strlen(p_parser->psz_object_name) ) )
{
#if 0
msg_Dbg( p_this, "loading config for module \"%s\"",
- (*pp_parser)->psz_object_name );
+ p_parser->psz_object_name );
#endif
break;
*p_index = (char)0;
psz_option_value = p_index + 1;
- if( !(*pp_parser)->i_config_items )
+ if( !p_parser->i_config_items )
{
continue;
}
/* try to match this option with one of the module's options */
- for( p_item = (*pp_parser)->p_config;
+ for( p_item = p_parser->p_config;
p_item->i_type != CONFIG_HINT_END;
p_item++ )
{
}
- vlc_list_release( p_list );
+ vlc_list_release( &list );
fclose( file );
free( psz_filename );
*****************************************************************************/
int __config_SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name )
{
- module_t **pp_parser;
- vlc_list_t *p_list;
+ module_t *p_parser;
+ vlc_list_t list;
module_config_t *p_item;
FILE *file;
char p_line[1024], *p_index2;
char *p_bigbuffer, *p_index;
vlc_bool_t b_backup;
char *psz_filename, *psz_homedir;
+ int i_index;
/* Acquire config file lock */
vlc_mutex_lock( &p_this->p_vlc->config_lock );
p_bigbuffer[0] = 0;
/* List all available modules */
- p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
+ list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
/* backup file into memory, we only need to backup the sections we won't
* save later on */
{
/* we found a section, check if we need to do a backup */
- for( pp_parser = (module_t **)p_list->pp_objects ;
- *pp_parser ;
- pp_parser++ )
+ for( i_index = 0; i_index < list.i_count; i_index++ )
{
+ p_parser = (module_t *)list.p_values[i_index].p_object ;
+
if( ((p_index2 - &p_line[1])
- == (int)strlen((*pp_parser)->psz_object_name) )
- && !memcmp( &p_line[1], (*pp_parser)->psz_object_name,
- strlen((*pp_parser)->psz_object_name) ) )
+ == (int)strlen(p_parser->psz_object_name) )
+ && !memcmp( &p_line[1], p_parser->psz_object_name,
+ strlen(p_parser->psz_object_name) ) )
{
if( !psz_module_name )
break;
else if( !strcmp( psz_module_name,
- (*pp_parser)->psz_object_name ) )
+ p_parser->psz_object_name ) )
break;
}
}
- if( !(*pp_parser) )
+ if( i_index == list.i_count )
{
/* we don't have this section in our list so we need to back
* it up */
msg_Warn( p_this, "could not open config file %s for writing",
psz_filename );
free( psz_filename );
- vlc_list_release( p_list );
+ vlc_list_release( &list );
vlc_mutex_unlock( &p_this->p_vlc->config_lock );
return -1;
}
fprintf( file, "###\n### " COPYRIGHT_MESSAGE "\n###\n\n" );
/* Look for the selected module, if NULL then save everything */
- for( pp_parser = (module_t **)p_list->pp_objects ;
- *pp_parser ;
- pp_parser++ )
+ for( i_index = 0; i_index < list.i_count; i_index++ )
{
+ p_parser = (module_t *)list.p_values[i_index].p_object ;
if( psz_module_name && strcmp( psz_module_name,
- (*pp_parser)->psz_object_name ) )
+ p_parser->psz_object_name ) )
continue;
- if( !(*pp_parser)->i_config_items )
+ if( !p_parser->i_config_items )
continue;
msg_Dbg( p_this, "saving config for module \"%s\"",
- (*pp_parser)->psz_object_name );
+ p_parser->psz_object_name );
- fprintf( file, "[%s]", (*pp_parser)->psz_object_name );
- if( (*pp_parser)->psz_longname )
- fprintf( file, " # %s\n\n", (*pp_parser)->psz_longname );
+ fprintf( file, "[%s]", p_parser->psz_object_name );
+ if( p_parser->psz_longname )
+ fprintf( file, " # %s\n\n", p_parser->psz_longname );
else
fprintf( file, "\n\n" );
- for( p_item = (*pp_parser)->p_config;
+ for( p_item = p_parser->p_config;
p_item->i_type != CONFIG_HINT_END;
p_item++ )
{
fprintf( file, "\n" );
}
- vlc_list_release( p_list );
+ vlc_list_release( &list );
/*
* Restore old settings from the config in file
vlc_bool_t b_ignore_errors )
{
int i_cmd, i_index, i_opts, i_shortopts, flag, i_verbose = 0;
- module_t **pp_parser;
- vlc_list_t *p_list;
+ module_t *p_parser;
+ vlc_list_t list;
module_config_t *p_item;
struct option *p_longopts;
+ int i_modules_index;
/* Short options */
module_config_t *pp_shortopts[256];
#endif
/* List all modules */
- p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
+ list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
/*
* Generate the longopts and shortopts structures used by getopt_long
*/
i_opts = 0;
- for( pp_parser = (module_t **)p_list->pp_objects ;
- *pp_parser ;
- pp_parser++ )
+ for( i_modules_index = 0; i_modules_index < list.i_count;
+ i_modules_index++ )
{
+ p_parser = (module_t *)list.p_values[i_modules_index].p_object ;
+
/* count the number of exported configuration options (to allocate
* longopts). We also need to allocate space for too options when
* dealing with boolean to allow for --foo and --no-foo */
- i_opts += (*pp_parser)->i_config_items
- + 2 * (*pp_parser)->i_bool_items;
+ i_opts += p_parser->i_config_items
+ + 2 * p_parser->i_bool_items;
}
p_longopts = malloc( sizeof(struct option) * (i_opts + 1) );
if( p_longopts == NULL )
{
msg_Err( p_this, "out of memory" );
- vlc_list_release( p_list );
+ vlc_list_release( &list );
return -1;
}
{
msg_Err( p_this, "out of memory" );
free( p_longopts );
- vlc_list_release( p_list );
+ vlc_list_release( &list );
return -1;
}
msg_Err( p_this, "out of memory" );
free( psz_shortopts );
free( p_longopts );
- vlc_list_release( p_list );
+ vlc_list_release( &list );
return -1;
}
memcpy( ppsz_argv, p_this->p_vlc->ppsz_argv,
/* Fill the p_longopts and psz_shortopts structures */
i_index = 0;
- for( pp_parser = (module_t **)p_list->pp_objects ;
- *pp_parser ;
- pp_parser++ )
+ for( i_modules_index = 0; i_modules_index < list.i_count;
+ i_modules_index++ )
{
- if( !(*pp_parser)->i_config_items )
+ p_parser = (module_t *)list.p_values[i_modules_index].p_object ;
+
+ if( !p_parser->i_config_items )
continue;
- for( p_item = (*pp_parser)->p_config;
+ for( p_item = p_parser->p_config;
p_item->i_type != CONFIG_HINT_END;
p_item++ )
{
}
/* We don't need the module list anymore */
- vlc_list_release( p_list );
+ vlc_list_release( &list );
/* Close the longopts and shortopts structures */
memset( &p_longopts[i_index], 0, sizeof(struct option) );
* modules.c : Builtin and plugin modules management functions
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: modules.c,v 1.107 2002/11/19 17:38:07 sam Exp $
+ * $Id: modules.c,v 1.108 2002/12/13 01:56:30 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Ethan C. Baldridge <BaldridgeE@cadmus.com>
};
module_list_t *p_list, *p_first, *p_tmp;
- vlc_list_t *p_all;
+ vlc_list_t all;
- int i_index = 0;
+ int i_which_module, i_index = 0;
vlc_bool_t b_intf = VLC_FALSE;
module_t *p_module;
- module_t **pp_parser;
int i_shortcuts = 0;
char *psz_shortcuts = NULL, *psz_var = NULL;
}
/* Sort the modules and test them */
- p_all = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
- p_list = malloc( p_all->i_count * sizeof( module_list_t ) );
+ all = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
+ p_list = malloc( all.i_count * sizeof( module_list_t ) );
p_first = NULL;
/* Parse the module list for capabilities and probe each of them */
- for( pp_parser = (module_t**)p_all->pp_objects ; *pp_parser ; pp_parser++ )
+ for( i_which_module = 0; i_which_module < all.i_count; i_which_module++ )
{
module_t * p_submodule = NULL;
int i_shortcut_bonus = 0, i_submodule;
- p_module = *pp_parser;
+ p_module = (module_t *)all.p_values[i_which_module].p_object;
/* Test that this module can do what we need */
if( strcmp( p_module->psz_capability, psz_capability ) )
}
/* We can release the list, interesting modules were yielded */
- vlc_list_release( p_all );
+ vlc_list_release( &all );
/* Parse the linked list and use the first successful module */
p_tmp = p_first;
return 0;
}
#endif /* HAVE_DYNAMIC_PLUGINS */
-
* objects.c: vlc_object_t handling
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: objects.c,v 1.31 2002/12/07 15:25:27 gbazin Exp $
+ * $Id: objects.c,v 1.32 2002/12/13 01:56:30 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
static int FindIndex ( vlc_object_t *, vlc_object_t **, int );
static void SetAttachment ( vlc_object_t *, vlc_bool_t );
-static vlc_list_t * NewList ( void );
-static vlc_list_t * ListAppend ( vlc_list_t *, vlc_object_t * );
+static vlc_list_t NewList ( int );
+static void ListReplace ( vlc_list_t *, vlc_object_t *, int );
+static void ListAppend ( vlc_list_t *, vlc_object_t * );
/*****************************************************************************
* Local structure lock
* This function recursively looks for a given object type. i_mode can be one
* of FIND_PARENT, FIND_CHILD or FIND_ANYWHERE.
*****************************************************************************/
-vlc_list_t * __vlc_list_find( vlc_object_t *p_this, int i_type, int i_mode )
+vlc_list_t __vlc_list_find( vlc_object_t *p_this, int i_type, int i_mode )
{
- vlc_list_t *p_list = NewList();
+ vlc_list_t list;
vlc_mutex_lock( &structure_lock );
if( (i_mode & 0x000f) == FIND_ANYWHERE )
{
vlc_object_t **pp_current, **pp_end;
+ int i_count = 0, i_index = 0;
pp_current = p_this->p_libvlc->pp_objects;
pp_end = pp_current + p_this->p_libvlc->i_objects;
if( (*pp_current)->b_attached
&& (*pp_current)->i_object_type == i_type )
{
- p_list = ListAppend( p_list, *pp_current );
+ i_count++;
+ }
+ }
+
+ list = NewList( i_count );
+ pp_current = p_this->p_libvlc->pp_objects;
+
+ for( ; pp_current < pp_end ; pp_current++ )
+ {
+ if( (*pp_current)->b_attached
+ && (*pp_current)->i_object_type == i_type )
+ {
+ ListReplace( &list, *pp_current, i_index );
+ if( i_index < i_count ) i_index++;
}
}
}
else
{
msg_Err( p_this, "unimplemented!" );
+ list = NewList( 0 );
}
vlc_mutex_unlock( &structure_lock );
- return p_list;
+ return list;
}
/*****************************************************************************
*****************************************************************************/
void vlc_list_release( vlc_list_t *p_list )
{
- if( p_list->i_count )
- {
- vlc_object_t ** pp_current = p_list->pp_objects;
+ int i_index;
+ for( i_index = 0; i_index < p_list->i_count; i_index++ )
+ {
vlc_mutex_lock( &structure_lock );
- while( pp_current[0] )
- {
- pp_current[0]->i_refcount--;
- pp_current++;
- }
+ p_list->p_values[i_index].p_object->i_refcount--;
vlc_mutex_unlock( &structure_lock );
}
- free( p_list );
+ free( p_list->p_values );
}
/* Following functions are local */
}
}
-static vlc_list_t * NewList( void )
+static vlc_list_t NewList( int i_count )
{
- vlc_list_t *p_list = malloc( sizeof( vlc_list_t )
- + 3 * sizeof( vlc_object_t * ) );
+ vlc_list_t list;
- if( p_list == NULL )
+ list.i_count = i_count;
+
+ if( i_count == 0 )
{
- return NULL;
+ list.p_values = NULL;
+ return list;
}
- p_list->i_count = 0;
- p_list->pp_objects = &p_list->_p_first;
+ list.p_values = malloc( i_count * sizeof( vlc_value_t ) );
+ if( list.p_values == NULL )
+ {
+ list.i_count = 0;
+ return list;
+ }
+
+ return list;
+}
+
+static void ListReplace( vlc_list_t *p_list, vlc_object_t *p_object,
+ int i_index )
+{
+ if( p_list == NULL || i_index >= p_list->i_count )
+ {
+ return;
+ }
- /* We allocated space for NULL and for three extra objects */
- p_list->_i_extra = 3;
- p_list->_p_first = NULL;
+ p_object->i_refcount++;
+
+ p_list->p_values[i_index].p_object = p_object;
- return p_list;
+ return;
}
-static vlc_list_t * ListAppend( vlc_list_t *p_list, vlc_object_t *p_object )
+static void ListAppend( vlc_list_t *p_list, vlc_object_t *p_object )
{
if( p_list == NULL )
{
- return NULL;
+ return;
}
- if( p_list->_i_extra == 0 )
+ p_list->p_values = realloc( p_list->p_values, (p_list->i_count + 1)
+ * sizeof( vlc_value_t ) );
+ if( p_list->p_values == NULL )
{
- /* If we had X objects it means the array has a size of X+1, we
- * make it size 2X+2, so we alloc 2X+1 because there is already
- * one allocated in the real structure */
- p_list = realloc( p_list, sizeof( vlc_list_t )
- + (p_list->i_count * 2 + 1)
- * sizeof( vlc_object_t * ) );
- if( p_list == NULL )
- {
- return NULL;
- }
-
- /* We have X+1 extra slots */
- p_list->_i_extra = p_list->i_count + 1;
- p_list->pp_objects = &p_list->_p_first;
+ p_list->i_count = 0;
+ return;
}
p_object->i_refcount++;
- p_list->pp_objects[p_list->i_count] = p_object;
+ p_list->p_values[p_list->i_count].p_object = p_object;
p_list->i_count++;
- p_list->pp_objects[p_list->i_count] = NULL;
- p_list->_i_extra--;
- return p_list;
+ return;
}