xf86RegisterRootWindowProperty is confused about xnfcalloc
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@oracle.com> Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
This commit is contained in:
parent
372a6f10dc
commit
33d6e6743d
|
@ -1734,7 +1734,6 @@ xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
|
||||||
int format, unsigned long len, pointer value )
|
int format, unsigned long len, pointer value )
|
||||||
{
|
{
|
||||||
RootWinPropPtr pNewProp = NULL, pRegProp;
|
RootWinPropPtr pNewProp = NULL, pRegProp;
|
||||||
int i;
|
|
||||||
Bool existing = FALSE;
|
Bool existing = FALSE;
|
||||||
|
|
||||||
DebugF("xf86RegisterRootWindowProperty(%d, %ld, %ld, %d, %ld, %p)\n",
|
DebugF("xf86RegisterRootWindowProperty(%d, %ld, %ld, %d, %ld, %p)\n",
|
||||||
|
@ -1775,15 +1774,11 @@ xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
|
||||||
|
|
||||||
DebugF("new property filled\n");
|
DebugF("new property filled\n");
|
||||||
|
|
||||||
if (NULL==xf86RegisteredPropertiesTable) {
|
if (xf86RegisteredPropertiesTable == NULL) {
|
||||||
DebugF("creating xf86RegisteredPropertiesTable[] size %d\n",
|
DebugF("creating xf86RegisteredPropertiesTable[] size %d\n",
|
||||||
xf86NumScreens);
|
xf86NumScreens);
|
||||||
if ( NULL==(xf86RegisteredPropertiesTable=(RootWinPropPtr*)xnfcalloc(sizeof(RootWinProp),xf86NumScreens) )) {
|
xf86RegisteredPropertiesTable =
|
||||||
return BadAlloc;
|
xnfcalloc(sizeof(RootWinProp), xf86NumScreens);
|
||||||
}
|
|
||||||
for (i=0; i<xf86NumScreens; i++) {
|
|
||||||
xf86RegisteredPropertiesTable[i] = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugF("xf86RegisteredPropertiesTable %p\n",
|
DebugF("xf86RegisteredPropertiesTable %p\n",
|
||||||
|
|
Loading…
Reference in New Issue