#include "http.h"
#include <limits.h>
-
-#include <assert.h>
+#include <errno.h>
+#include <ctype.h>
+#include <fcntl.h>
/* Utility function for scandir */
static int Filter( const char *foo )
v->value = strdup( value ? value : "" );
v->i_field = 0;
- v->field = malloc( sizeof( mvar_t * ) );
+ v->field = xmalloc( sizeof( mvar_t * ) );
v->field[0] = NULL;
return v;
void mvar_AppendVar( mvar_t *v, mvar_t *f )
{
- v->field = realloc( v->field, sizeof( mvar_t * ) * ( v->i_field + 2 ) );
+ v->field = xrealloc( v->field, sizeof( mvar_t * ) * ( v->i_field + 2 ) );
v->field[v->i_field] = f;
v->i_field++;
}
void mvar_PushVar( mvar_t *v, mvar_t *f )
{
- v->field = realloc( v->field, sizeof( mvar_t * ) * ( v->i_field + 2 ) );
+ v->field = xrealloc( v->field, sizeof( mvar_t * ) * ( v->i_field + 2 ) );
if( v->i_field > 0 )
{
memmove( &v->field[1], &v->field[0], sizeof( mvar_t * ) * v->i_field );
return NULL;
}
-char *mvar_GetValue( mvar_t *v, char *field )
+const char *mvar_GetValue( mvar_t *v, const char *field )
{
if( *field == '\0' )
{
playlist_t *p_pl )
{
mvar_t *s = mvar_New( name, "set" );
- vlc_object_lock( p_pl );
+ playlist_Lock( p_pl );
PlaylistListNode( p_intf, p_pl, p_pl->p_root_category , name, s, 0 );
- vlc_object_unlock( p_pl );
+ playlist_Unlock( p_pl );
return s;
}
mvar_t *mvar_ObjectSetNew( intf_thread_t *p_intf, char *psz_name,
const char *psz_capability )
{
+ VLC_UNUSED(p_intf);
mvar_t *s = mvar_New( psz_name, "set" );
- int i;
+ size_t i;
- vlc_list_t *p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE,
- FIND_ANYWHERE );
+ module_t **p_list = module_list_get( NULL );
- for( i = 0; i < p_list->i_count; i++ )
+ for( i = 0; p_list[i]; i++ )
{
- module_t *p_parser = (module_t *)p_list->p_values[i].p_object;
- if( module_IsCapable( p_parser, psz_capability ) )
+ module_t *p_parser = p_list[i];
+ if( module_provides( p_parser, psz_capability ) )
{
- mvar_t *sd = mvar_New( "sd", module_GetObjName( p_parser ) );
+ mvar_t *sd = mvar_New( "sd", module_get_object( p_parser ) );
mvar_AppendNewVar( sd, "name",
- module_GetName( p_parser, true ) );
+ module_get_name( p_parser, true ) );
mvar_AppendVar( s, sd );
}
}
- vlc_list_release( p_list );
+ module_list_free( p_list );
return s;
}
for( i = 0; i < val_list.p_list->i_count; i++ )
{
- char *psz, psz_int[16];
+ char psz_int[16];
mvar_t *itm;
switch( i_type & VLC_VAR_TYPE )
{
case VLC_VAR_STRING:
itm = mvar_New( name, "set" );
- /* FIXME: Memory leak here?? (remove strdup?) */
- psz = strdup( text_list.p_list->p_values[i].psz_string );
- mvar_AppendNewVar( itm, "name", psz );
+ mvar_AppendNewVar( itm, "name", text_list.p_list->p_values[i].psz_string );
mvar_AppendNewVar( itm, "id", val_list.p_list->p_values[i].psz_string );
snprintf( psz_int, sizeof(psz_int), "%d",
( !strcmp( val.psz_string,
case VLC_VAR_INTEGER:
itm = mvar_New( name, "set" );
- psz = strdup( text_list.p_list->p_values[i].psz_string );
- mvar_AppendNewVar( itm, "name", psz );
+ mvar_AppendNewVar( itm, "name", text_list.p_list->p_values[i].psz_string );
snprintf( psz_int, sizeof(psz_int), "%d",
val_list.p_list->p_values[i].i_int );
mvar_AppendNewVar( itm, "id", psz_int );
}
/* clean up everything */
if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string );
- var_Change( p_sys->p_input, psz_variable, VLC_VAR_FREELIST, &val_list,
- &text_list );
+ var_FreeList( &val_list, &text_list );
return s;
}