[vlc-devel] [PATCH 4/5] vout: win32: drawable: simplify the known hwnd filling
Steve Lhomme
robux4 at ycbcr.xyz
Thu May 7 14:39:11 CEST 2020
No need to reset val to 0/NULL each time.
---
modules/video_output/drawable.c | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/modules/video_output/drawable.c b/modules/video_output/drawable.c
index 7417900bc76c..ad82afadd9e9 100644
--- a/modules/video_output/drawable.c
+++ b/modules/video_output/drawable.c
@@ -107,24 +107,20 @@ static int Open(vout_window_t *wnd)
if (used[n] == val)
{
msg_Warn (wnd, "HWND 0x%p is busy", val);
- val = 0;
- goto skip;
+ vlc_mutex_unlock (&serializer);
+ return VLC_EGENERIC;
}
tab = realloc (used, sizeof (*used) * (n + 2));
- if (likely(tab != NULL))
- {
- used = tab;
- used[n] = val;
- used[n + 1] = 0;
+ if (unlikely(tab == NULL)) {
+ vlc_mutex_unlock (&serializer);
+ return VLC_ENOMEM;
}
- else
- val = 0;
-skip:
- vlc_mutex_unlock (&serializer);
+ used = tab;
+ used[n] = val;
+ used[n + 1] = 0;
- if (val == 0)
- return VLC_EGENERIC;
+ vlc_mutex_unlock (&serializer);
wnd->type = VOUT_WINDOW_TYPE_HWND;
wnd->handle.hwnd = (void *)val;
--
2.17.1
More information about the vlc-devel
mailing list