[vlc-commits] commit: ML: Remove asserts in vlc_media_library.h (Srikanth Raju )

git at videolan.org git at videolan.org
Sat Jul 3 20:22:18 CEST 2010


vlc | branch: master | Srikanth Raju <srikiraju at gmail.com> | Sat Jul  3 19:10:48 2010 +0530| [26105b49cfd13aa52e8a6cafb5e90f17aa5e7711] | committer: Srikanth Raju 

ML: Remove asserts in vlc_media_library.h

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=26105b49cfd13aa52e8a6cafb5e90f17aa5e7711
---

 include/vlc_media_library.h |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/include/vlc_media_library.h b/include/vlc_media_library.h
index 15ef025..2200018 100644
--- a/include/vlc_media_library.h
+++ b/include/vlc_media_library.h
@@ -33,7 +33,6 @@ extern "C" {
 # endif
 
 #include <vlc_common.h>
-#include <assert.h>
 #include <vlc_playlist.h>
 
 /*****************************************************************************
@@ -520,12 +519,12 @@ static inline void ml_gc_incref( ml_media_t* p_media )
 {
     unsigned refs;
     ml_gc_object_t* p_gc = &p_media->ml_gc_data;
-    assert( p_gc );
+    if( p_gc == NULL )
+        return;
 
     vlc_spin_lock (&p_gc->spin);
     refs = ++p_gc->refs;
     vlc_spin_unlock (&p_gc->spin);
-    assert (refs != 1); /* there had to be a reference already */
 }
 
 /**
@@ -538,13 +537,12 @@ static inline void ml_gc_decref( ml_media_t* p_media )
     unsigned refs;
     bool pool;
     ml_gc_object_t* p_gc = &p_media->ml_gc_data;
-    assert( p_gc );
+    if( p_gc == NULL )
+        return;
 
     vlc_spin_lock (&p_gc->spin);
-    assert( p_gc->refs != 0 );
     refs = --p_gc->refs;
     pool = p_gc->pool;
-    assert( ( refs != 0 && p_gc->pool == true ) || ( refs == 0 && p_gc->pool == false )  );
     vlc_spin_unlock (&p_gc->spin);
 
     if( refs == 0 && pool == false )
@@ -708,7 +706,7 @@ static inline int ml_CopyPersons( ml_person_t** a, ml_person_t* b );
 static inline int ml_CopyMedia( ml_media_t *b, ml_media_t *a )
 {
     if( !a || !b ) return VLC_EGENERIC;
-    assert( a != b );
+    if( a == b ) return VLC_SUCCESS;
     ml_LockMedia( a );
     ml_LockMedia( b );
     b->b_sparse = a->b_sparse;
@@ -1100,7 +1098,8 @@ ml_Delete( media_library_t *p_media_library, vlc_array_t* p_array )
 static inline int ml_CreateAppendPersonAdv( ml_person_t **pp_person,
         const char* psz_role, const char* psz_name, int i_id )
 {
-    assert( i_id || ( psz_name && *psz_name && psz_role && *psz_role ) );
+    if( i_id == 0 || !( psz_name && *psz_name && psz_role && *psz_role ) )
+        return VLC_SUCCESS;
     if( !pp_person )
         return VLC_EGENERIC;
     if( *pp_person != NULL )



More information about the vlc-commits mailing list