[PATCH v2 01/10] Xext: Fix buggy checks.
Alan Coopersmith
alan.coopersmith at oracle.com
Thu Jun 2 19:44:00 PDT 2011
On 06/ 2/11 06:00 PM, Cyril Brulebois wrote:
> 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;
Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
--
-Alan Coopersmith- alan.coopersmith at oracle.com
Oracle Solaris Platform Engineering: X Window System
More information about the xorg-devel
mailing list