From: RĂ©mi Denis-Courmont Date: Tue, 2 Feb 2010 21:36:24 +0000 (+0200) Subject: Media discovery: remove exception X-Git-Tag: 1.1.0-ff~524 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=c8869bbd73fee7f4c3562b4eccd836cfca0e8eb2;p=vlc Media discovery: remove exception --- diff --git a/include/vlc/libvlc_media_discoverer.h b/include/vlc/libvlc_media_discoverer.h index 38392dd870..a1a7396b4b 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 23e06c3beb..32fdfdebdc 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; }