[PATCH v2 01/10] Xext: Fix buggy checks.

Cyril Brulebois kibi at debian.org
Thu Jun 2 18:00:36 PDT 2011


As noted in a comment, that can't actually happen. Use the check
proposed by Alan Coopersmith and Jeremy Huddleston instead.

Those warnings go away accordingly:
|   CC     xvmc.lo
| xvmc.c: In function 'XvMCExtensionInit':
| xvmc.c:671:21: warning: the comparison will always evaluate as 'false' for the address of 'XvMCScreenKeyRec' will never be NULL [-Waddress]
| xvmc.c: In function 'XvMCFindXvImage':
| xvmc.c:749:22: warning: the comparison will always evaluate as 'false' for the address of 'XvMCScreenKeyRec' will never be NULL [-Waddress]

Signed-off-by: Cyril Brulebois <kibi at debian.org>
---
 Xext/xvmc.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/Xext/xvmc.c b/Xext/xvmc.c
index 4d29941..d790d3c 100644
--- a/Xext/xvmc.c
+++ b/Xext/xvmc.c
@@ -668,8 +668,8 @@ XvMCExtensionInit(void)
 {
    ExtensionEntry *extEntry;
 
-   if(XvMCScreenKey == NULL) /* nobody supports it */
-	return; 
+   if (!dixPrivateKeyRegistered(XvMCScreenKey))
+	return;
 
    if(!(XvMCRTContext = CreateNewResourceType(XvMCDestroyContextRes,
 					      "XvMCRTContext")))
@@ -746,7 +746,8 @@ XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id)
     XvMCAdaptorPtr adaptor = NULL;
     int i;
 
-    if(XvMCScreenKey == NULL) return NULL;
+    if (!dixPrivateKeyRegistered(XvMCScreenKey))
+        return NULL;
 
     if(!(pScreenPriv = XVMC_GET_PRIVATE(pScreen))) 
         return NULL;
-- 
1.7.5.3



More information about the xorg-devel mailing list