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 <[email protected]> --- hw/xfree86/common/xf86Helper.c | 10 +++------- 1 files changed, 3 insertions(+), 7 deletions(-) diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index d99522c..054e9f1 100644 --- a/hw/xfree86/common/xf86Helper.c +++ b/hw/xfree86/common/xf86Helper.c @@ -1775,15 +1775,11 @@ xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type, DebugF("new property filled\n"); - if (NULL==xf86RegisteredPropertiesTable) { + if (xf86RegisteredPropertiesTable == NULL) { DebugF("creating xf86RegisteredPropertiesTable[] size %d\n", xf86NumScreens); - if ( NULL==(xf86RegisteredPropertiesTable=(RootWinPropPtr*)xnfcalloc(sizeof(RootWinProp),xf86NumScreens) )) { - return BadAlloc; - } - for (i=0; i<xf86NumScreens; i++) { - xf86RegisteredPropertiesTable[i] = NULL; - } + xf86RegisteredPropertiesTable = + xnfcalloc(sizeof(RootWinProp), xf86NumScreens); } DebugF("xf86RegisteredPropertiesTable %p\n", -- 1.7.3.2 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
