[vlc-devel] [PATCH 2/6] display: remove useless pointer

RĂ©mi Denis-Courmont remi at remlab.net
Wed Jul 24 21:38:35 CEST 2019


If vd->module is NULL, then vd->close is NULL and vlc_objres_clear() is
a no-op, so there are no needs to check.
---
 include/vlc_vout_display.h |  3 ---
 src/video_output/display.c | 24 +++++++++---------------
 2 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
index 42484514b6..cc5dbd2032 100644
--- a/include/vlc_vout_display.h
+++ b/include/vlc_vout_display.h
@@ -220,9 +220,6 @@ typedef int (*vout_display_open_cb)(vout_display_t *vd,
 struct vout_display_t {
     struct vlc_object_t obj;
 
-    /* Module */
-    module_t *module;
-
     /* Initial and current configuration.
      * You cannot modify it directly, you must use the appropriate events.
      *
diff --git a/src/video_output/display.c b/src/video_output/display.c
index b8d72e7543..91b95f3767 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -776,11 +776,9 @@ vout_display_t *vout_display_New(vlc_object_t *parent,
     vlc_video_context *video_context = osys->video_context.device ?
         &osys->video_context : NULL;
 
-    vd->module = vlc_module_load(vd, "vout display", module,
-                                 module && *module != '\0',
-                                 vout_display_start, vd, &osys->cfg,
-                                 &vd->fmt, video_context);
-    if (vd->module == NULL)
+    if (vlc_module_load(vd, "vout display", module, module && *module != '\0',
+                        vout_display_start, vd, &osys->cfg, &vd->fmt,
+                        video_context) == NULL)
         goto error;
 
 #if defined(__OS2__)
@@ -796,11 +794,9 @@ vout_display_t *vout_display_New(vlc_object_t *parent,
 #endif
 
     if (VoutDisplayCreateRender(vd)) {
-        if (vd->module != NULL) {
-            if (vd->close != NULL)
-                vd->close(vd);
-            vlc_objres_clear(VLC_OBJECT(vd));
-        }
+        if (vd->close != NULL)
+            vd->close(vd);
+        vlc_objres_clear(VLC_OBJECT(vd));
         video_format_Clean(&vd->fmt);
         goto error;
     }
@@ -823,11 +819,9 @@ void vout_display_Delete(vout_display_t *vd)
     if (osys->pool != NULL)
         picture_pool_Release(osys->pool);
 
-    if (vd->module != NULL) {
-        if (vd->close != NULL)
-            vd->close(vd);
-        vlc_objres_clear(VLC_OBJECT(vd));
-    }
+    if (vd->close != NULL)
+        vd->close(vd);
+    vlc_objres_clear(VLC_OBJECT(vd));
 
     if (osys->video_context.device)
         vlc_decoder_device_Release(osys->video_context.device);
-- 
2.22.0



More information about the vlc-devel mailing list