[vlc-commits] vout: win32: drawable: move the known hwnd removal in a function

Steve Lhomme git at videolan.org
Mon May 11 09:14:03 CEST 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu May  7 12:22:06 2020 +0200| [ea72a487faae446b0a3d30da00020d78870b3312] | committer: Steve Lhomme

vout: win32: drawable: move the known hwnd removal in a function

No functional changes.

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

 modules/video_output/drawable.c | 44 +++++++++++++++++++++++------------------
 1 file changed, 25 insertions(+), 19 deletions(-)

diff --git a/modules/video_output/drawable.c b/modules/video_output/drawable.c
index a21c40ca0a..63dc6c8e87 100644
--- a/modules/video_output/drawable.c
+++ b/modules/video_output/drawable.c
@@ -64,6 +64,30 @@ static const struct vout_window_operations ops = {
     .destroy = Close,
 };
 
+static void RemoveDrawable(uintptr_t val)
+{
+    size_t n = 0;
+
+    /* Remove this drawable from the list of busy ones */
+    vlc_mutex_lock (&serializer);
+    assert (used != NULL);
+    while (used[n] != val)
+    {
+        assert (used[n]);
+        n++;
+    }
+    do
+        used[n] = used[n + 1];
+    while (used[++n] != 0);
+
+    if (n == 0)
+    {
+        free (used);
+        used = NULL;
+    }
+    vlc_mutex_unlock (&serializer);
+}
+
 /**
  * Find the drawable set by libvlc application.
  */
@@ -114,24 +138,6 @@ skip:
 static void Close (vout_window_t *wnd)
 {
     uintptr_t val = (uintptr_t)wnd->sys;
-    size_t n = 0;
 
-    /* Remove this drawable from the list of busy ones */
-    vlc_mutex_lock (&serializer);
-    assert (used != NULL);
-    while (used[n] != val)
-    {
-        assert (used[n]);
-        n++;
-    }
-    do
-        used[n] = used[n + 1];
-    while (used[++n] != 0);
-
-    if (n == 0)
-    {
-         free (used);
-         used = NULL;
-    }
-    vlc_mutex_unlock (&serializer);
+    RemoveDrawable(val);
 }



More information about the vlc-commits mailing list