summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2008-10-06 14:19:30 -0400
committerAdam Jackson <ajax@redhat.com>2008-10-06 14:19:30 -0400
commit0b7b89fbac0b3865b2cf51295c68a5f4c7523f28 (patch)
treecf24e95113974c482e0cc1bbb6be19c8b25879e7
parent9187f6ad9ec7ba9569a93d92561aac17eaa83491 (diff)
xalloc+bzero -> xcalloc
-rw-r--r--Xi/exevents.c7
-rw-r--r--dbe/dbe.c3
-rw-r--r--dix/devices.c28
-rw-r--r--dix/dispatch.c6
-rw-r--r--dix/glyphcurs.c4
-rw-r--r--hw/kdrive/src/kinfo.c6
-rw-r--r--hw/kdrive/src/kinput.c4
-rw-r--r--hw/xfree86/xaa/xaaCpyPlane.c4
-rw-r--r--hw/xfree86/xaa/xaaNonTEText.c3
-rw-r--r--mi/mibitblt.c3
-rw-r--r--render/glyph.c3
-rw-r--r--render/render.c6
12 files changed, 19 insertions, 58 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c
index d59a87d1a..6f652794f 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1516,12 +1516,11 @@ AddExtensionClient(WindowPtr pWin, ClientPtr client, Mask mask, int mskidx)
if (!pWin->optional && !MakeWindowOptional(pWin))
return BadAlloc;
- others = (InputClients *) xalloc(sizeof(InputClients));
+ others = xcalloc(1, sizeof(InputClients));
if (!others)
return BadAlloc;
if (!pWin->optional->inputMasks && !MakeInputMasks(pWin))
return BadAlloc;
- bzero((char *)&others->mask[0], sizeof(Mask) * EMASKSIZE);
others->mask[mskidx] = mask;
others->resource = FakeClientID(client->index);
others->next = pWin->optional->inputMasks->inputClients;
@@ -1536,11 +1535,9 @@ MakeInputMasks(WindowPtr pWin)
{
struct _OtherInputMasks *imasks;
- imasks = (struct _OtherInputMasks *)
- xalloc(sizeof(struct _OtherInputMasks));
+ imasks = xcalloc(1, sizeof(struct _OtherInputMasks));
if (!imasks)
return FALSE;
- bzero((char *)imasks, sizeof(struct _OtherInputMasks));
pWin->optional->inputMasks = imasks;
return TRUE;
}
diff --git a/dbe/dbe.c b/dbe/dbe.c
index 1a08bdab9..bd2778938 100644
--- a/dbe/dbe.c
+++ b/dbe/dbe.c
@@ -297,10 +297,9 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
* Allocate a window priv.
*/
- pDbeWindowPriv = (DbeWindowPrivPtr)xalloc(sizeof(DbeWindowPrivRec));
+ pDbeWindowPriv = xcalloc(1, sizeof(DbeWindowPrivRec));
if (!pDbeWindowPriv)
return(BadAlloc);
- bzero(pDbeWindowPriv, sizeof(DbeWindowPrivRec));
/* Fill out window priv information. */
pDbeWindowPriv->pWindow = pWin;
diff --git a/dix/devices.c b/dix/devices.c
index adb012f4a..5e0b68f3c 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -495,13 +495,12 @@ CoreKeyboardProc(DeviceIntPtr pDev, int what)
return BadAlloc;
}
- modMap = (CARD8 *)xalloc(MAP_LENGTH);
+ modMap = xcalloc(1, MAP_LENGTH);
if (!modMap) {
ErrorF("[dix] Couldn't allocate core modifier map\n");
xfree(classes);
return BadAlloc;
}
- bzero((char *)modMap, MAP_LENGTH);
#ifdef XKB
if (!noXkbExtension) {
@@ -1141,10 +1140,9 @@ InitModMap(KeyClassPtr keyc)
}
}
}
- keyc->modifierKeyMap = (KeyCode *)xalloc(8*keyc->maxKeysPerModifier);
+ keyc->modifierKeyMap = xcalloc(8, keyc->maxKeysPerModifier);
if (!keyc->modifierKeyMap && keyc->maxKeysPerModifier)
return (FALSE);
- bzero((char *)keyc->modifierKeyMap, 8*(int)keyc->maxKeysPerModifier);
for (i = 0; i < 8; i++)
keysPerModifier[i] = 0;
for (i = 8; i < MAP_LENGTH; i++)
@@ -1168,24 +1166,13 @@ InitKeyClassDeviceStruct(DeviceIntPtr dev, KeySymsPtr pKeySyms, CARD8 pModifiers
int i;
KeyClassPtr keyc;
- keyc = (KeyClassPtr)xalloc(sizeof(KeyClassRec));
+ keyc = xcalloc(1, sizeof(KeyClassRec));
if (!keyc)
return FALSE;
- keyc->curKeySyms.map = (KeySym *)NULL;
- keyc->curKeySyms.mapWidth = 0;
keyc->curKeySyms.minKeyCode = pKeySyms->minKeyCode;
keyc->curKeySyms.maxKeyCode = pKeySyms->maxKeyCode;
- keyc->modifierKeyMap = (KeyCode *)NULL;
- keyc->state = 0;
- keyc->prev_state = 0;
if (pModifiers)
memmove((char *)keyc->modifierMap, (char *)pModifiers, MAP_LENGTH);
- else
- bzero((char *)keyc->modifierMap, MAP_LENGTH);
- bzero((char *)keyc->down, DOWN_LENGTH);
- bzero((char *)keyc->postdown, DOWN_LENGTH);
- for (i = 0; i < 8; i++)
- keyc->modifierKeyCount[i] = 0;
if (!SetKeySymsMap(&keyc->curKeySyms, pKeySyms) || !InitModMap(keyc))
{
xfree(keyc->curKeySyms.map);
@@ -1208,19 +1195,12 @@ InitButtonClassDeviceStruct(DeviceIntPtr dev, int numButtons,
ButtonClassPtr butc;
int i;
- butc = (ButtonClassPtr)xalloc(sizeof(ButtonClassRec));
+ butc = xcalloc(1, sizeof(ButtonClassRec));
if (!butc)
return FALSE;
butc->numButtons = numButtons;
for (i = 1; i <= numButtons; i++)
butc->map[i] = map[i];
- butc->buttonsDown = 0;
- butc->state = 0;
- butc->motionMask = 0;
- bzero((char *)butc->down, sizeof(butc->down));
-#ifdef XKB
- butc->xkb_acts= NULL;
-#endif
dev->button = butc;
return TRUE;
}
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 64cde4900..d14f8dce1 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -2875,18 +2875,16 @@ ProcCreateCursor (ClientPtr client)
return (BadMatch);
n = BitmapBytePad(width)*height;
- srcbits = (unsigned char *)xalloc(n);
+ srcbits = xcalloc(1, n);
if (!srcbits)
return (BadAlloc);
- mskbits = (unsigned char *)xalloc(n);
+ mskbits = xalloc(n);
if (!mskbits)
{
xfree(srcbits);
return (BadAlloc);
}
- /* zeroing the (pad) bits helps some ddx cursor handling */
- bzero((char *)srcbits, n);
(* src->drawable.pScreen->GetImage)( (DrawablePtr)src, 0, 0, width, height,
XYPixmap, 1, (pointer)srcbits);
if ( msk == (PixmapPtr)NULL)
diff --git a/dix/glyphcurs.c b/dix/glyphcurs.c
index 905b5fb13..f74b13730 100644
--- a/dix/glyphcurs.c
+++ b/dix/glyphcurs.c
@@ -91,11 +91,9 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm, unsigned cha
pScreen = screenInfo.screens[0];
nby = BitmapBytePad(cm->width) * (long)cm->height;
- pbits = (char *)xalloc(nby);
+ pbits = xcalloc(1, nby);
if (!pbits)
return BadAlloc;
- /* zeroing the (pad) bits seems to help some ddx cursor handling */
- bzero(pbits, nby);
ppix = (PixmapPtr)(*pScreen->CreatePixmap)(pScreen, cm->width,
cm->height, 1,
diff --git a/hw/kdrive/src/kinfo.c b/hw/kdrive/src/kinfo.c
index 2621f10dd..d592e6803 100644
--- a/hw/kdrive/src/kinfo.c
+++ b/hw/kdrive/src/kinfo.c
@@ -34,10 +34,9 @@ KdCardInfoAdd (KdCardFuncs *funcs,
{
KdCardInfo *ci, **prev;
- ci = (KdCardInfo *) xalloc (sizeof (KdCardInfo));
+ ci = xcalloc (1, sizeof (KdCardInfo));
if (!ci)
return 0;
- bzero (ci, sizeof (KdCardInfo));
for (prev = &kdCardInfo; *prev; prev = &(*prev)->next);
*prev = ci;
ci->cfuncs = funcs;
@@ -80,10 +79,9 @@ KdScreenInfoAdd (KdCardInfo *ci)
KdScreenInfo *si, **prev;
int n;
- si = (KdScreenInfo *) xalloc (sizeof (KdScreenInfo));
+ si = xcalloc (1, sizeof (KdScreenInfo));
if (!si)
return 0;
- bzero (si, sizeof (KdScreenInfo));
for (prev = &ci->screenList, n = 0; *prev; prev = &(*prev)->next, n++);
*prev = si;
si->next = 0;
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index e200c5493..b44218dcf 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -1127,12 +1127,10 @@ KdGetOptions (InputOption **options, char *string)
InputOption *newopt = NULL, **tmpo = NULL;
int tam_key = 0;
- newopt = (InputOption *) xalloc(sizeof (InputOption));
+ newopt = xcalloc(1, sizeof (InputOption));
if (!newopt)
return FALSE;
- bzero(newopt, sizeof (InputOption));
-
for (tmpo = options; *tmpo; tmpo = &(*tmpo)->next)
; /* Hello, I'm here */
*tmpo = newopt;
diff --git a/hw/xfree86/xaa/xaaCpyPlane.c b/hw/xfree86/xaa/xaaCpyPlane.c
index a0ebb75d2..aa4c0407c 100644
--- a/hw/xfree86/xaa/xaaCpyPlane.c
+++ b/hw/xfree86/xaa/xaaCpyPlane.c
@@ -131,11 +131,9 @@ XAACopyPlaneNtoNColorExpand(
h = height = pbox->y2 - pbox->y1;
pitch = BitmapBytePad(width);
- if(!(data = xalloc(height * pitch)))
+ if(!(data = xcalloc(height, pitch)))
goto ALLOC_FAILED;
- bzero(data, height * pitch);
-
dataPtr = data;
srcPtr = ((pptSrc->y) * srcwidth) + src +
((pptSrc->x) * Bpp) + offset;
diff --git a/hw/xfree86/xaa/xaaNonTEText.c b/hw/xfree86/xaa/xaaNonTEText.c
index d4661e879..d32c0bbc5 100644
--- a/hw/xfree86/xaa/xaaNonTEText.c
+++ b/hw/xfree86/xaa/xaaNonTEText.c
@@ -291,8 +291,7 @@ PolyGlyphBltAsSingleBitmap (
pitch = (Right - Left + 31) >> 5;
size = (pitch << 2) * (Bottom - Top);
- block = (CARD32*)xalloc(size);
- bzero(block, size);
+ block = xcalloc(1, size);
topLine = 10000; botLine = -10000;
diff --git a/mi/mibitblt.c b/mi/mibitblt.c
index 99375b660..3e82a5592 100644
--- a/mi/mibitblt.c
+++ b/mi/mibitblt.c
@@ -317,11 +317,10 @@ miGetPlane(
sy += pDraw->y;
widthInBytes = BitmapBytePad(w);
if(!result)
- result = (MiBits *)xalloc(h * widthInBytes);
+ result = xcalloc(h, widthInBytes);
if (!result)
return (MiBits *)NULL;
bitsPerPixel = pDraw->bitsPerPixel;
- bzero((char *)result, h * widthInBytes);
pOut = (OUT_TYPE *) result;
if(bitsPerPixel == 1)
{
diff --git a/render/glyph.c b/render/glyph.c
index 849e65fce..ae04f6029 100644
--- a/render/glyph.c
+++ b/render/glyph.c
@@ -513,10 +513,9 @@ AllocateGlyphSet (int fdepth, PictFormatPtr format)
}
size = sizeof (GlyphSetRec);
- glyphSet = xalloc (size);
+ glyphSet = xcalloc (1, size);
if (!glyphSet)
return FALSE;
- bzero((char *)glyphSet, size);
if (!AllocateGlyphHash (&glyphSet->hash, &glyphHashSets[0]))
{
diff --git a/render/render.c b/render/render.c
index 1b7d78b87..9e04a137f 100644
--- a/render/render.c
+++ b/render/render.c
@@ -1571,21 +1571,19 @@ ProcRenderCreateCursor (ClientPtr client)
stride = BitmapBytePad(width);
nbytes_mono = stride*height;
- srcbits = (unsigned char *)xalloc(nbytes_mono);
+ srcbits = xcalloc(nbytes_mono);
if (!srcbits)
{
xfree (argbbits);
return (BadAlloc);
}
- mskbits = (unsigned char *)xalloc(nbytes_mono);
+ mskbits = xcalloc(nbytes_mono);
if (!mskbits)
{
xfree(argbbits);
xfree(srcbits);
return (BadAlloc);
}
- bzero ((char *) mskbits, nbytes_mono);
- bzero ((char *) srcbits, nbytes_mono);
if (pSrc->format == PICT_a8r8g8b8)
{