[vlc-devel] commit: XCB-XV: cosmetic, kill a few gotos ( Rémi Denis-Courmont )

git version control git at videolan.org
Sun Nov 15 15:33:50 CET 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Nov 15 16:07:36 2009 +0200| [1ea1c3f90730a99e8f93a50e6ed2d8510ffa2e30] | committer: Rémi Denis-Courmont 

XCB-XV: cosmetic, kill a few gotos

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

 modules/video_output/xcb/xvideo.c |   32 ++++++++++++++++----------------
 1 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/modules/video_output/xcb/xvideo.c b/modules/video_output/xcb/xvideo.c
index 10c9ef1..7957998 100644
--- a/modules/video_output/xcb/xvideo.c
+++ b/modules/video_output/xcb/xvideo.c
@@ -374,7 +374,7 @@ static int Open (vlc_object_t *obj)
             chromas = chromas_default;
 
         vlc_fourcc_t chroma;
-        for (size_t i = 0; chromas[i] && (xfmt == NULL); i++)
+        for (size_t i = 0; chromas[i]; i++)
         {
             chroma = chromas[i];
 
@@ -388,10 +388,22 @@ static int Open (vlc_object_t *obj)
             }
 
             xfmt = FindFormat (vd, chroma, &fmt, a->base_id, r, &p_sys->att);
+            if (xfmt != NULL)
+            {
+                p_sys->id = xfmt->id;
+                fmt.i_chroma = chroma;
+                if (xfmt->type == XCB_XV_IMAGE_FORMAT_INFO_TYPE_RGB)
+                {
+                    fmt.i_rmask = xfmt->red_mask;
+                    fmt.i_gmask = xfmt->green_mask;
+                    fmt.i_bmask = xfmt->blue_mask;
+                }
+                break;
+            }
         }
-
+        free (r);
         if (xfmt == NULL) /* No acceptable image formats */
-            goto skip_adaptor;
+            continue;
 
         /* Grab a port */
         for (unsigned i = 0; i < a->num_ports; i++)
@@ -412,7 +424,7 @@ static int Open (vlc_object_t *obj)
              msg_Dbg (vd, "cannot grab port %"PRIu32, port);
         }
         if (!found_adaptor)
-            goto skip_adaptor;
+            continue;
 
         /* Found port - initialize selected format */
         name = strndup (xcb_xv_adaptor_info_name (a), a->name_size);
@@ -422,19 +434,7 @@ static int Open (vlc_object_t *obj)
             free (name);
         }
         msg_Dbg (vd, "using port %"PRIu32, p_sys->port);
-
-        p_sys->id = xfmt->id;
         msg_Dbg (vd, "using image format 0x%"PRIx32, p_sys->id);
-        fmt.i_chroma = chroma;
-        if (xfmt->type == XCB_XV_IMAGE_FORMAT_INFO_TYPE_RGB)
-        {
-            fmt.i_rmask = xfmt->red_mask;
-            fmt.i_gmask = xfmt->green_mask;
-            fmt.i_bmask = xfmt->blue_mask;
-        }
-
-    skip_adaptor:
-        free (r);
     }
     free (adaptors);
     if (!found_adaptor)




More information about the vlc-devel mailing list