[vlc-devel] commit: Media discovery: remove exception ( Rémi Denis-Courmont )

git version control git at videolan.org
Tue Feb 2 22:45:15 CET 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Feb  2 23:36:24 2010 +0200| [c8869bbd73fee7f4c3562b4eccd836cfca0e8eb2] | committer: Rémi Denis-Courmont 

Media discovery: remove exception

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

 include/vlc/libvlc_media_discoverer.h |    6 ++----
 src/control/media_discoverer.c        |   14 ++++++--------
 2 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/include/vlc/libvlc_media_discoverer.h b/include/vlc/libvlc_media_discoverer.h
index 38392dd..a1a7396 100644
--- a/include/vlc/libvlc_media_discoverer.h
+++ b/include/vlc/libvlc_media_discoverer.h
@@ -51,13 +51,11 @@ typedef struct libvlc_media_discoverer_t libvlc_media_discoverer_t;
  *
  * \param p_inst libvlc instance
  * \param psz_name service name
- * \param p_e an initialized exception object
- * \return media discover object
+ * \return media discover object or NULL in case of error
  */
 VLC_PUBLIC_API libvlc_media_discoverer_t *
 libvlc_media_discoverer_new_from_name( libvlc_instance_t * p_inst,
-                                       const char * psz_name,
-                                       libvlc_exception_t * p_e );
+                                       const char * psz_name );
 
 /**
  * Release media discover object. If the reference count reaches 0, then
diff --git a/src/control/media_discoverer.c b/src/control/media_discoverer.c
index 23e06c3..32fdfde 100644
--- a/src/control/media_discoverer.c
+++ b/src/control/media_discoverer.c
@@ -170,15 +170,13 @@ static void services_discovery_ended( const vlc_event_t * p_event,
  **************************************************************************/
 libvlc_media_discoverer_t *
 libvlc_media_discoverer_new_from_name( libvlc_instance_t * p_inst,
-                                       const char * psz_name,
-                                       libvlc_exception_t * p_e )
+                                       const char * psz_name )
 {
     libvlc_media_discoverer_t * p_mdis;
 
     p_mdis = malloc(sizeof(libvlc_media_discoverer_t));
-    if( !p_mdis )
+    if( unlikely(!p_mdis) )
     {
-        libvlc_exception_raise( p_e );
         libvlc_printerr( "Not enough memory" );
         return NULL;
     }
@@ -206,9 +204,9 @@ libvlc_media_discoverer_new_from_name( libvlc_instance_t * p_inst,
 
     if( !p_mdis->p_sd )
     {
-        libvlc_media_list_release( p_mdis->p_mlist );
-        libvlc_exception_raise( p_e );
         libvlc_printerr( "%s: no such discovery module found", psz_name );
+        libvlc_media_list_release( p_mdis->p_mlist );
+        libvlc_event_manager_release( p_mdis->p_event_manager );
         free( p_mdis );
         return NULL;
     }
@@ -233,9 +231,9 @@ libvlc_media_discoverer_new_from_name( libvlc_instance_t * p_inst,
     /* Here we go */
     if( !vlc_sd_Start( p_mdis->p_sd, psz_name ) )
     {
-        libvlc_media_list_release( p_mdis->p_mlist );
-        libvlc_exception_raise( p_e );
         libvlc_printerr( "%s: internal module error", psz_name );
+        libvlc_media_list_release( p_mdis->p_mlist );
+        libvlc_event_manager_release( p_mdis->p_event_manager );
         free( p_mdis );
         return NULL;
     }




More information about the vlc-devel mailing list