#ifndef _LIBVLC_MEDIA_LIST_PATH_H
#define _LIBVLC_MEDIA_LIST_PATH_H 1
-#include <assert.h>
-#include <vlc_memory.h>
-
typedef int * libvlc_media_list_path_t; /* (Media List Player Internal) */
/**************************************************************************
**************************************************************************/
static inline libvlc_media_list_path_t libvlc_media_list_path_empty( void )
{
- libvlc_media_list_path_t ret = malloc(sizeof(int));
- assert( ret );
+ libvlc_media_list_path_t ret = xmalloc(sizeof(int));
ret[0] = -1;
return ret;
}
**************************************************************************/
static inline libvlc_media_list_path_t libvlc_media_list_path_with_root_index( int index )
{
- libvlc_media_list_path_t ret = malloc(sizeof(int)*2);
- assert( ret );
+ libvlc_media_list_path_t ret = xmalloc(sizeof(int)*2);
ret[0] = index;
ret[1] = -1;
return ret;
static inline void libvlc_media_list_path_append( libvlc_media_list_path_t * p_path, int index )
{
int old_depth = libvlc_media_list_path_depth( *p_path );
- *p_path = realloc_or_free( *p_path, sizeof(int)*(old_depth+2));
- assert( *p_path );
+ *p_path = xrealloc( *p_path, sizeof(int)*(old_depth+2));
*p_path[old_depth] = index;
*p_path[old_depth+1] = -1;
}
{
libvlc_media_list_path_t ret;
int old_depth = libvlc_media_list_path_depth( path );
- ret = malloc( sizeof(int) * (old_depth + 2) );
- assert( ret );
+ ret = xmalloc( sizeof(int) * (old_depth + 2) );
memcpy( ret, path, sizeof(int) * old_depth );
ret[old_depth] = index;
ret[old_depth+1] = -1;
{
libvlc_media_list_path_t ret;
int depth = libvlc_media_list_path_depth( path );
- ret = malloc( sizeof(int)*(depth+1) );
- assert( ret );
+ ret = xmalloc( sizeof(int)*(depth+1) );
memcpy( ret, path, sizeof(int)*(depth+1) );
return ret;
}
get_path_rec( const libvlc_media_list_path_t path, libvlc_media_list_t * p_current_mlist, libvlc_media_t * p_searched_md )
{
int i, count;
- count = libvlc_media_list_count( p_current_mlist, NULL );
+ count = libvlc_media_list_count( p_current_mlist );
for( i = 0; i < count; i++ )
{
- libvlc_media_t * p_md = libvlc_media_list_item_at_index( p_current_mlist, i, NULL );
+ libvlc_media_t * p_md = libvlc_media_list_item_at_index( p_current_mlist, i );
if( p_md == p_searched_md )
return libvlc_media_list_path_copy_by_appending( path, i ); /* Found! */
int i;
for( i = 0; path[i] != -1; i++ )
{
- p_md = libvlc_media_list_item_at_index( p_current_mlist, path[i], NULL );
+ p_md = libvlc_media_list_item_at_index( p_current_mlist, path[i] );
if( p_current_mlist != p_mlist )
libvlc_media_list_release( p_current_mlist );
return p_current_mlist;
}
- p_md = libvlc_media_list_item_at_index( p_current_mlist, path[i], NULL );
+ p_md = libvlc_media_list_item_at_index( p_current_mlist, path[i] );
p_current_mlist = libvlc_media_subitems( p_md );
libvlc_media_release( p_md );