]> git.sesse.net Git - vlc/blobdiff - modules/access_output/bonjour.c
Don't print a message a malloc failed.
[vlc] / modules / access_output / bonjour.c
index d4dbc1456a5510b08018221dfac663f580315042..37814deb0d454ee9277a0bdef3ed4e933bd10b2f 100644 (file)
@@ -29,7 +29,7 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
 #include "bonjour.h"
 
 #ifdef HAVE_AVAHI_CLIENT
@@ -185,7 +185,7 @@ static void poll_iterate_thread( poll_thread_t *p_pt )
 {
     vlc_thread_ready( p_pt );
 
-    while( !p_pt->b_die )
+    while( vlc_object_alive (p_pt) )
         if( avahi_simple_poll_iterate( p_pt->simple_poll, 100 ) != 0 )
             break;
 }
@@ -201,10 +201,7 @@ void *bonjour_start_service( vlc_object_t *p_log, const char *psz_stype,
 
     p_sys = (bonjour_t *)malloc( sizeof(*p_sys) );
     if( p_sys == NULL )
-    {
-        msg_Err( p_log, "out of memory" );
         return NULL;
-    }
 
     memset( p_sys, 0, sizeof(*p_sys) );
 
@@ -214,19 +211,13 @@ void *bonjour_start_service( vlc_object_t *p_log, const char *psz_stype,
     p_sys->psz_name = avahi_strdup( psz_name );
     p_sys->psz_stype = avahi_strdup( psz_stype );
     if( p_sys->psz_name == NULL || p_sys->psz_stype == NULL )
-    {
-        msg_Err( p_sys->p_log, "out of memory" );
         goto error;
-    }
 
     if( psz_txt != NULL )
     {
         p_sys->psz_txt = avahi_strdup( psz_txt );
         if( p_sys->psz_txt == NULL )
-        {
-            msg_Err( p_sys->p_log, "out of memory" );
             goto error;
-        }
     }
 
     p_sys->simple_poll = avahi_simple_poll_new();
@@ -251,15 +242,12 @@ void *bonjour_start_service( vlc_object_t *p_log, const char *psz_stype,
     p_sys->poll_thread = vlc_object_create( p_sys->p_log,
                                             sizeof(poll_thread_t) );
     if( p_sys->poll_thread == NULL )
-    {
-        msg_Err( p_sys->p_log, "out of memory" );
         goto error;
-    }
     p_sys->poll_thread->simple_poll = p_sys->simple_poll;
 
     if( vlc_thread_create( p_sys->poll_thread, "Avahi Poll Iterate Thread",
                            poll_iterate_thread,
-                           VLC_THREAD_PRIORITY_HIGHEST, VLC_FALSE ) )
+                           VLC_THREAD_PRIORITY_HIGHEST, false ) )
     {
         msg_Err( p_sys->p_log, "failed to create poll iterate thread" );
         goto error;
@@ -269,7 +257,7 @@ void *bonjour_start_service( vlc_object_t *p_log, const char *psz_stype,
 
 error:
     if( p_sys->poll_thread != NULL )
-        vlc_object_destroy( p_sys->poll_thread );
+        vlc_object_release( p_sys->poll_thread );
     if( p_sys->client != NULL )
         avahi_client_free( p_sys->client );
     if( p_sys->simple_poll != NULL )
@@ -295,7 +283,7 @@ void bonjour_stop_service( void *_p_sys )
 
     vlc_object_kill( p_sys->poll_thread );
     vlc_thread_join( p_sys->poll_thread );
-    vlc_object_destroy( p_sys->poll_thread );
+    vlc_object_release( p_sys->poll_thread );
 
     if( p_sys->group != NULL )
         avahi_entry_group_free( p_sys->group );