[vlc-commits] display: remove useless pointer

Rémi Denis-Courmont git at videolan.org
Thu Jul 25 18:52:51 CEST 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jul 24 22:32:27 2019 +0300| [0404116817bf87e307f518bec82773910482e4de] | committer: Rémi Denis-Courmont

display: remove useless pointer

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.

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

 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 1a1677e332..e95e9539f1 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);



More information about the vlc-commits mailing list