[vlc-devel] commit: dc1394: factorize. ( Rémi Duraffort )

git version control git at videolan.org
Fri Dec 4 11:19:06 CET 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Fri Dec  4 10:55:23 2009 +0100| [c6aba4ba31f30b7e19b37d59f6c15d7634f6b7bf] | committer: Rémi Duraffort 

dc1394: factorize.

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

 modules/access/dc1394.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/modules/access/dc1394.c b/modules/access/dc1394.c
index ec3ea6a..1b3e162 100644
--- a/modules/access/dc1394.c
+++ b/modules/access/dc1394.c
@@ -122,21 +122,20 @@ static int process_options( demux_t *p_demux);
 static int FindCamera( demux_sys_t *sys, demux_t *p_demux )
 {
     dc1394camera_list_t *list;
+    int i_ret = VLC_EGENERIC;
 
     msg_Dbg( p_demux, "Scanning for ieee1394 ports ..." );
 
     if( dc1394_camera_enumerate (sys->p_dccontext, &list) != DC1394_SUCCESS )
     {
         msg_Err(p_demux, "Can not ennumerate cameras");
-        dc1394_camera_free_list (list);
-        return VLC_EGENERIC;
+        goto end;
     }
 
     if( list->num == 0 )
     {
         msg_Err(p_demux, "Can not find cameras");
-        dc1394_camera_free_list (list);
-        return VLC_EGENERIC;
+        goto end;
     }
 
     sys->num_cameras = list->num;
@@ -159,16 +158,14 @@ static int FindCamera( demux_sys_t *sys, demux_t *p_demux )
         {
             msg_Err( p_demux, "Can't find camera with uid : 0x%llx.",
                      sys->selected_uid );
-            dc1394_camera_free_list (list);
-            return VLC_EGENERIC;
+            goto end;
         }
     }
     else if( sys->selected_camera >= (int)list->num )
     {
         msg_Err( p_demux, "There are not this many cameras. (%d/%d)",
                  sys->selected_camera, sys->num_cameras );
-        dc1394_camera_free_list (list);
-        return VLC_EGENERIC;
+        goto end;
     }
     else if( sys->selected_camera >= 0 )
     {
@@ -181,8 +178,11 @@ static int FindCamera( demux_sys_t *sys, demux_t *p_demux )
                                           list->ids[0].guid);
     }
 
+    i_ret = VLC_SUCCESS;
+
+end:
     dc1394_camera_free_list (list);
-    return VLC_SUCCESS;
+    return i_ret;
 }
 
 /*****************************************************************************




More information about the vlc-devel mailing list