[PATCH] __GLX_MEM_COPY(): no need to check for NULL pointers

Tomas Carnecky tom at dbservice.com
Tue Feb 3 16:40:15 PST 2009

warning: the address of ‘XXX’ will always evaluate as ‘true’

This macro is exclusively used on pointers that are guaranteed
to be valid. Either because the variable is on the stack, or
the pointer is already being dereferenced earlier so by the time
the macro is used, we can rely on it being valid.

Signed-off-by: Tomas Carnecky <tom at dbservice.com>

Thanks for the review.

Btw, the code in dmx/glxProxy/ also doesn't have this check.
grep -E '(__GLX_MEM_COPY|__GLX_GET_DOUBLE)' -r glx/ hw/dmx/glxProxy/

 glx/unpack.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/glx/unpack.h b/glx/unpack.h
index a1dd17d..675d8cc 100644
--- a/glx/unpack.h
+++ b/glx/unpack.h
@@ -47,7 +47,7 @@
 ** Fetch a double from potentially unaligned memory.
 #ifdef __GLX_ALIGN64
-#define __GLX_MEM_COPY(dst,src,n)	if (src && dst) memcpy(dst,src,n)
+#define __GLX_MEM_COPY(dst,src,n)	memcpy(dst,src,n)
 #define __GLX_GET_DOUBLE(dst,src)	__GLX_MEM_COPY(&dst,src,8)
 #define __GLX_GET_DOUBLE(dst,src)	(dst) = *((GLdouble*)(src))

More information about the xorg mailing list