changeset 33811:c1299d6cbc4e

Make NULL checks simpler/more consistent.
author reimar
date Sun, 24 Jul 2011 19:02:38 +0000
parents 9d6f166e7070
children 268d0a7c02bd
files libvo/vo_directx.c
diffstat 1 files changed, 13 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_directx.c	Sun Jul 24 18:21:15 2011 +0000
+++ b/libvo/vo_directx.c	Sun Jul 24 19:02:38 2011 +0000
@@ -308,25 +308,24 @@
 
 static void uninit(void)
 {
-    if (g_cc != NULL) {
+    if (g_cc)
         g_cc->lpVtbl->Release(g_cc);
-    }
     g_cc = NULL;
-    if (g_lpddclipper != NULL)
+    if (g_lpddclipper)
         g_lpddclipper->lpVtbl->Release(g_lpddclipper);
     g_lpddclipper = NULL;
     mp_msg(MSGT_VO, MSGL_DBG3, "<vo_directx><INFO>clipper released\n");
-    if (g_lpddsBack != NULL)
+    if (g_lpddsBack)
         g_lpddsBack->lpVtbl->Release(g_lpddsBack);
     g_lpddsBack = NULL;
     mp_msg(MSGT_VO, MSGL_DBG3, "<vo_directx><INFO>back surface released\n");
     if (vo_doublebuffering && !nooverlay) {
-        if (g_lpddsOverlay != NULL)
+        if (g_lpddsOverlay)
             g_lpddsOverlay->lpVtbl->Release(g_lpddsOverlay);
         g_lpddsOverlay = NULL;
         mp_msg(MSGT_VO, MSGL_DBG3, "<vo_directx><INFO>overlay surface released\n");
     }
-    if (g_lpddsPrimary != NULL)
+    if (g_lpddsPrimary)
         g_lpddsPrimary->lpVtbl->Release(g_lpddsPrimary);
     g_lpddsPrimary = NULL;
     mp_msg(MSGT_VO, MSGL_DBG3, "<vo_directx><INFO>primary released\n");
@@ -334,7 +333,7 @@
         DeleteObject(colorbrush);
     colorbrush = NULL;
     mp_msg(MSGT_VO, MSGL_DBG3, "<vo_directx><INFO>GDI resources deleted\n");
-    if (g_lpdd != NULL) {
+    if (g_lpdd) {
         if (vidmode)
             g_lpdd->lpVtbl->RestoreDisplayMode(g_lpdd);
         g_lpdd->lpVtbl->Release(g_lpdd);
@@ -382,7 +381,7 @@
 
     //load direct draw DLL: based on videolans code
     hddraw_dll = LoadLibrary("DDRAW.DLL");
-    if (hddraw_dll == NULL) {
+    if (!hddraw_dll) {
         mp_msg(MSGT_VO, MSGL_FATAL, "<vo_directx><FATAL ERROR>failed loading ddraw.dll\n");
         return 1;
     }
@@ -405,7 +404,7 @@
     }
 
     OurDirectDrawCreateEx = (void *)GetProcAddress(hddraw_dll, "DirectDrawCreateEx");
-    if (OurDirectDrawCreateEx == NULL) {
+    if (!OurDirectDrawCreateEx) {
         FreeLibrary(hddraw_dll);
         hddraw_dll = NULL;
         mp_msg(MSGT_VO, MSGL_FATAL, "<vo_directx><FATAL ERROR>failed geting proc address: DirectDrawCreateEx\n");
@@ -702,7 +701,7 @@
             formatcount++;
         } else
             mp_msg(MSGT_VO, MSGL_V, "<vo_directx><FORMAT OVERLAY>%i %s not supported\n", i, g_ddpf[i].img_format_name);
-        if (g_lpddsOverlay != NULL) {
+        if (g_lpddsOverlay) {
             g_lpddsOverlay->lpVtbl->Release(g_lpddsOverlay);
             g_lpddsOverlay = NULL;
         }
@@ -988,20 +987,20 @@
         nooverlay = 0;
 
     /*release all directx objects*/
-    if (g_cc != NULL)
+    if (g_cc)
         g_cc->lpVtbl->Release(g_cc);
     g_cc = NULL;
     if (g_lpddclipper)
         g_lpddclipper->lpVtbl->Release(g_lpddclipper);
     g_lpddclipper = NULL;
-    if (g_lpddsBack != NULL)
+    if (g_lpddsBack)
         g_lpddsBack->lpVtbl->Release(g_lpddsBack);
     g_lpddsBack = NULL;
     if (vo_doublebuffering)
-        if (g_lpddsOverlay != NULL)
+        if (g_lpddsOverlay)
             g_lpddsOverlay->lpVtbl->Release(g_lpddsOverlay);
     g_lpddsOverlay = NULL;
-    if (g_lpddsPrimary != NULL)
+    if (g_lpddsPrimary)
         g_lpddsPrimary->lpVtbl->Release(g_lpddsPrimary);
     g_lpddsPrimary = NULL;
     mp_msg(MSGT_VO, MSGL_DBG3, "<vo_directx><INFO>overlay surfaces released\n");