[PATCH] xf86RegisterRootWindowProperty is confused about xnfcalloc

Alan Coopersmith alan.coopersmith at oracle.com
Fri Dec 9 09:09:51 PST 2011


On 12/09/11 04:14, Paulo Zanoni wrote:
> 2011/12/8 Alan Coopersmith<alan.coopersmith at oracle.com>:
>> It will never return NULL, so don't try to handle a NULL condition,
>> since that just confuses programmers and static analyzers.
>>
>> It uses calloc, so all the allocated memory is cleared, so there's
>> no point looping over the memory to manually initialize it NULL.
>>
>> And just because it's annoying, it doesn't need to be the only
>> place in this file to do if (NULL==...) instead of if (... == NULL).
>>
>> Signed-off-by: Alan Coopersmith<alan.coopersmith at oracle.com>
>> ---
>
> xf86Helper.c:1737:9: warning: unused variable 'i' [-Wunused-variable]
>
> With the variable declaration removed:
> Reviewed-by: Paulo Zanoni<paulo.r.zanoni at intel.com>

Oh, good catch - thanks for checking that - I'll amend the patch to include:

diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index 054e9f1..248ccf4 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -1734,7 +1734,6 @@ xf86RegisterRootWindowProperty(int ScrnIndex, Atom propert
                                int format, unsigned long len, pointer value )
  {
      RootWinPropPtr pNewProp = NULL, pRegProp;
-    int i;
      Bool existing = FALSE;

      DebugF("xf86RegisterRootWindowProperty(%d, %ld, %ld, %d, %ld, %p)\n",



-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System



More information about the xorg-devel mailing list