summaryrefslogtreecommitdiff
path: root/dix
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 /dix
parent9187f6ad9ec7ba9569a93d92561aac17eaa83491 (diff)
xalloc+bzero -> xcalloc
Diffstat (limited to 'dix')
-rw-r--r--dix/devices.c28
-rw-r--r--dix/dispatch.c6
-rw-r--r--dix/glyphcurs.c4
3 files changed, 7 insertions, 31 deletions
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,