]> git.sesse.net Git - vlc/blobdiff - src/control/core.c
src/control: a bit of cleanup here and there
[vlc] / src / control / core.c
index 2934e09ee2c9f3d774b0e7b9884441f568cda3f6..e7d22653ced54cc873aba0160a91b8adfae67702 100644 (file)
@@ -63,14 +63,13 @@ inline void libvlc_exception_raise( libvlc_exception_t *p_exception,
     va_list args;
 
     /* does caller care about exceptions ? */
-    if( p_exception == NULL )
-       return;
+    if( p_exception == NULL ) return;
 
     /* remove previous exception if it wasn't cleared */
     if( p_exception->b_raised && p_exception->psz_message )
     {
-       free(p_exception->psz_message);
-       p_exception->psz_message = NULL;
+        free(p_exception->psz_message);
+        p_exception->psz_message = NULL;
     }
 
     va_start( args, psz_format );
@@ -81,7 +80,7 @@ inline void libvlc_exception_raise( libvlc_exception_t *p_exception,
 }
 
 libvlc_instance_t * libvlc_new( int argc, char **argv,
-                                libvlc_exception_t *p_exception )
+                                libvlc_exception_t *p_e )
 {
     int i_vlc_id;
     libvlc_instance_t *p_new;
@@ -90,21 +89,14 @@ libvlc_instance_t * libvlc_new( int argc, char **argv,
     i_vlc_id = VLC_Create();
     p_vlc = (vlc_t* ) vlc_current_object( i_vlc_id );
 
-    if( !p_vlc )
-    {
-        libvlc_exception_raise( p_exception, "VLC initialization failed" );
-        return NULL;
-    }
+    if( !p_vlc ) RAISENULL( "VLC initialization failed" );
+
     p_new = (libvlc_instance_t *)malloc( sizeof( libvlc_instance_t ) );
+    if( !p_new ) RAISENULL( "Out of memory" );
 
     /** \todo Look for interface settings. If we don't have any, add -I dummy */
     /* Because we probably don't want a GUI by default */
 
-    if( !p_new )
-    {
-        libvlc_exception_raise( p_exception, "Out of memory" );
-        return NULL;
-    }
 
     VLC_Init( i_vlc_id, argc, argv );
 
@@ -113,13 +105,9 @@ libvlc_instance_t * libvlc_new( int argc, char **argv,
                                 VLC_OBJECT_PLAYLIST, FIND_CHILD );
     p_new->p_vlm = NULL;
 
-    if( !p_new->p_playlist )
-    {
-        libvlc_exception_raise( p_exception, "Playlist creation failed" );
-        return NULL;
-    }
+    if( !p_new->p_playlist ) RAISENULL( "Playlist creation failed" );
+    
     p_new->i_vlc_id = i_vlc_id;
-
     return p_new;
 }
 
@@ -136,4 +124,3 @@ int libvlc_get_vlc_id( libvlc_instance_t *p_instance )
 {
     return p_instance->i_vlc_id;
 }
-