devPrivates rework: minor fix; use calloc and avoid initialization.

This commit is contained in:
Eamon Walsh
2007-04-05 12:12:58 -04:00
committed by Eamon Walsh
parent ed75b05651
commit 1d550bb2c5
3 changed files with 8 additions and 14 deletions

View File

@@ -720,20 +720,17 @@ AddScreen(
/* must pre-allocate one private for the new devPrivates support */
pScreen->WindowPrivateLen = 1;
pScreen->WindowPrivateSizes = (unsigned *)xalloc(sizeof(unsigned));
pScreen->WindowPrivateSizes = (unsigned *)xcalloc(1, sizeof(unsigned));
pScreen->totalWindowSize = PadToLong(sizeof(WindowRec)) + sizeof(DevUnion);
pScreen->GCPrivateLen = 1;
pScreen->GCPrivateSizes = (unsigned *)xalloc(sizeof(unsigned));
pScreen->GCPrivateSizes = (unsigned *)xcalloc(1, sizeof(unsigned));
pScreen->totalGCSize = PadToLong(sizeof(GC)) + sizeof(DevUnion);
pScreen->PixmapPrivateLen = 1;
pScreen->PixmapPrivateSizes = (unsigned *)xalloc(sizeof(unsigned));
pScreen->PixmapPrivateSizes = (unsigned *)xcalloc(1, sizeof(unsigned));
pScreen->totalPixmapSize = BitmapBytePad(8 * (sizeof(PixmapRec) +
sizeof(DevUnion)));
if (pScreen->WindowPrivateSizes && pScreen->GCPrivateSizes &&
pScreen->PixmapPrivateSizes)
*pScreen->WindowPrivateSizes = *pScreen->GCPrivateSizes =
*pScreen->PixmapPrivateSizes = 0;
else {
if (!pScreen->WindowPrivateSizes || !pScreen->GCPrivateSizes ||
!pScreen->PixmapPrivateSizes) {
xfree(pScreen);
return -1;
}