]> git.sesse.net Git - vlc/blobdiff - src/control/media_list_path.h
Use var_Inherit* instead of var_CreateGet*.
[vlc] / src / control / media_list_path.h
index 994587ce56f31ee30145b0ab7713f1beea63b46a..f3565069a0e8c0431293dfb58d5bc5e4b85680d9 100644 (file)
@@ -25,9 +25,6 @@
 #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) */
 
 /**************************************************************************
@@ -52,8 +49,7 @@ static inline void libvlc_media_list_path_dump( const libvlc_media_list_path_t p
  **************************************************************************/
 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;
 }
@@ -63,8 +59,7 @@ static inline libvlc_media_list_path_t libvlc_media_list_path_empty( void )
  **************************************************************************/
 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;
@@ -86,8 +81,7 @@ static inline int libvlc_media_list_path_depth( const libvlc_media_list_path_t p
 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;
 }
@@ -99,8 +93,7 @@ static inline libvlc_media_list_path_t libvlc_media_list_path_copy_by_appending(
 {
     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;
@@ -114,8 +107,7 @@ static inline libvlc_media_list_path_t libvlc_media_list_path_copy( const libvlc
 {
     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;
 }
@@ -127,10 +119,10 @@ static libvlc_media_list_path_t
 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! */
@@ -175,7 +167,7 @@ libvlc_media_list_item_at_path( libvlc_media_list_t * p_mlist, const libvlc_medi
     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 );
@@ -217,7 +209,7 @@ libvlc_media_list_parentlist_at_path( libvlc_media_list_t * p_mlist, const libvl
             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 );