xalloc+bzero -> xcalloc
This commit is contained in:
parent
9187f6ad9e
commit
0b7b89fbac
|
@ -1516,12 +1516,11 @@ AddExtensionClient(WindowPtr pWin, ClientPtr client, Mask mask, int mskidx)
|
||||||
|
|
||||||
if (!pWin->optional && !MakeWindowOptional(pWin))
|
if (!pWin->optional && !MakeWindowOptional(pWin))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
others = (InputClients *) xalloc(sizeof(InputClients));
|
others = xcalloc(1, sizeof(InputClients));
|
||||||
if (!others)
|
if (!others)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
if (!pWin->optional->inputMasks && !MakeInputMasks(pWin))
|
if (!pWin->optional->inputMasks && !MakeInputMasks(pWin))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
bzero((char *)&others->mask[0], sizeof(Mask) * EMASKSIZE);
|
|
||||||
others->mask[mskidx] = mask;
|
others->mask[mskidx] = mask;
|
||||||
others->resource = FakeClientID(client->index);
|
others->resource = FakeClientID(client->index);
|
||||||
others->next = pWin->optional->inputMasks->inputClients;
|
others->next = pWin->optional->inputMasks->inputClients;
|
||||||
|
@ -1536,11 +1535,9 @@ MakeInputMasks(WindowPtr pWin)
|
||||||
{
|
{
|
||||||
struct _OtherInputMasks *imasks;
|
struct _OtherInputMasks *imasks;
|
||||||
|
|
||||||
imasks = (struct _OtherInputMasks *)
|
imasks = xcalloc(1, sizeof(struct _OtherInputMasks));
|
||||||
xalloc(sizeof(struct _OtherInputMasks));
|
|
||||||
if (!imasks)
|
if (!imasks)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
bzero((char *)imasks, sizeof(struct _OtherInputMasks));
|
|
||||||
pWin->optional->inputMasks = imasks;
|
pWin->optional->inputMasks = imasks;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -297,10 +297,9 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
|
||||||
* Allocate a window priv.
|
* Allocate a window priv.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pDbeWindowPriv = (DbeWindowPrivPtr)xalloc(sizeof(DbeWindowPrivRec));
|
pDbeWindowPriv = xcalloc(1, sizeof(DbeWindowPrivRec));
|
||||||
if (!pDbeWindowPriv)
|
if (!pDbeWindowPriv)
|
||||||
return(BadAlloc);
|
return(BadAlloc);
|
||||||
bzero(pDbeWindowPriv, sizeof(DbeWindowPrivRec));
|
|
||||||
|
|
||||||
/* Fill out window priv information. */
|
/* Fill out window priv information. */
|
||||||
pDbeWindowPriv->pWindow = pWin;
|
pDbeWindowPriv->pWindow = pWin;
|
||||||
|
|
|
@ -495,13 +495,12 @@ CoreKeyboardProc(DeviceIntPtr pDev, int what)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
modMap = (CARD8 *)xalloc(MAP_LENGTH);
|
modMap = xcalloc(1, MAP_LENGTH);
|
||||||
if (!modMap) {
|
if (!modMap) {
|
||||||
ErrorF("[dix] Couldn't allocate core modifier map\n");
|
ErrorF("[dix] Couldn't allocate core modifier map\n");
|
||||||
xfree(classes);
|
xfree(classes);
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
bzero((char *)modMap, MAP_LENGTH);
|
|
||||||
|
|
||||||
#ifdef XKB
|
#ifdef XKB
|
||||||
if (!noXkbExtension) {
|
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)
|
if (!keyc->modifierKeyMap && keyc->maxKeysPerModifier)
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
bzero((char *)keyc->modifierKeyMap, 8*(int)keyc->maxKeysPerModifier);
|
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
keysPerModifier[i] = 0;
|
keysPerModifier[i] = 0;
|
||||||
for (i = 8; i < MAP_LENGTH; i++)
|
for (i = 8; i < MAP_LENGTH; i++)
|
||||||
|
@ -1168,24 +1166,13 @@ InitKeyClassDeviceStruct(DeviceIntPtr dev, KeySymsPtr pKeySyms, CARD8 pModifiers
|
||||||
int i;
|
int i;
|
||||||
KeyClassPtr keyc;
|
KeyClassPtr keyc;
|
||||||
|
|
||||||
keyc = (KeyClassPtr)xalloc(sizeof(KeyClassRec));
|
keyc = xcalloc(1, sizeof(KeyClassRec));
|
||||||
if (!keyc)
|
if (!keyc)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
keyc->curKeySyms.map = (KeySym *)NULL;
|
|
||||||
keyc->curKeySyms.mapWidth = 0;
|
|
||||||
keyc->curKeySyms.minKeyCode = pKeySyms->minKeyCode;
|
keyc->curKeySyms.minKeyCode = pKeySyms->minKeyCode;
|
||||||
keyc->curKeySyms.maxKeyCode = pKeySyms->maxKeyCode;
|
keyc->curKeySyms.maxKeyCode = pKeySyms->maxKeyCode;
|
||||||
keyc->modifierKeyMap = (KeyCode *)NULL;
|
|
||||||
keyc->state = 0;
|
|
||||||
keyc->prev_state = 0;
|
|
||||||
if (pModifiers)
|
if (pModifiers)
|
||||||
memmove((char *)keyc->modifierMap, (char *)pModifiers, MAP_LENGTH);
|
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))
|
if (!SetKeySymsMap(&keyc->curKeySyms, pKeySyms) || !InitModMap(keyc))
|
||||||
{
|
{
|
||||||
xfree(keyc->curKeySyms.map);
|
xfree(keyc->curKeySyms.map);
|
||||||
|
@ -1208,19 +1195,12 @@ InitButtonClassDeviceStruct(DeviceIntPtr dev, int numButtons,
|
||||||
ButtonClassPtr butc;
|
ButtonClassPtr butc;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
butc = (ButtonClassPtr)xalloc(sizeof(ButtonClassRec));
|
butc = xcalloc(1, sizeof(ButtonClassRec));
|
||||||
if (!butc)
|
if (!butc)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
butc->numButtons = numButtons;
|
butc->numButtons = numButtons;
|
||||||
for (i = 1; i <= numButtons; i++)
|
for (i = 1; i <= numButtons; i++)
|
||||||
butc->map[i] = map[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;
|
dev->button = butc;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2875,18 +2875,16 @@ ProcCreateCursor (ClientPtr client)
|
||||||
return (BadMatch);
|
return (BadMatch);
|
||||||
|
|
||||||
n = BitmapBytePad(width)*height;
|
n = BitmapBytePad(width)*height;
|
||||||
srcbits = (unsigned char *)xalloc(n);
|
srcbits = xcalloc(1, n);
|
||||||
if (!srcbits)
|
if (!srcbits)
|
||||||
return (BadAlloc);
|
return (BadAlloc);
|
||||||
mskbits = (unsigned char *)xalloc(n);
|
mskbits = xalloc(n);
|
||||||
if (!mskbits)
|
if (!mskbits)
|
||||||
{
|
{
|
||||||
xfree(srcbits);
|
xfree(srcbits);
|
||||||
return (BadAlloc);
|
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,
|
(* src->drawable.pScreen->GetImage)( (DrawablePtr)src, 0, 0, width, height,
|
||||||
XYPixmap, 1, (pointer)srcbits);
|
XYPixmap, 1, (pointer)srcbits);
|
||||||
if ( msk == (PixmapPtr)NULL)
|
if ( msk == (PixmapPtr)NULL)
|
||||||
|
|
|
@ -91,11 +91,9 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm, unsigned cha
|
||||||
|
|
||||||
pScreen = screenInfo.screens[0];
|
pScreen = screenInfo.screens[0];
|
||||||
nby = BitmapBytePad(cm->width) * (long)cm->height;
|
nby = BitmapBytePad(cm->width) * (long)cm->height;
|
||||||
pbits = (char *)xalloc(nby);
|
pbits = xcalloc(1, nby);
|
||||||
if (!pbits)
|
if (!pbits)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
/* zeroing the (pad) bits seems to help some ddx cursor handling */
|
|
||||||
bzero(pbits, nby);
|
|
||||||
|
|
||||||
ppix = (PixmapPtr)(*pScreen->CreatePixmap)(pScreen, cm->width,
|
ppix = (PixmapPtr)(*pScreen->CreatePixmap)(pScreen, cm->width,
|
||||||
cm->height, 1,
|
cm->height, 1,
|
||||||
|
|
|
@ -34,10 +34,9 @@ KdCardInfoAdd (KdCardFuncs *funcs,
|
||||||
{
|
{
|
||||||
KdCardInfo *ci, **prev;
|
KdCardInfo *ci, **prev;
|
||||||
|
|
||||||
ci = (KdCardInfo *) xalloc (sizeof (KdCardInfo));
|
ci = xcalloc (1, sizeof (KdCardInfo));
|
||||||
if (!ci)
|
if (!ci)
|
||||||
return 0;
|
return 0;
|
||||||
bzero (ci, sizeof (KdCardInfo));
|
|
||||||
for (prev = &kdCardInfo; *prev; prev = &(*prev)->next);
|
for (prev = &kdCardInfo; *prev; prev = &(*prev)->next);
|
||||||
*prev = ci;
|
*prev = ci;
|
||||||
ci->cfuncs = funcs;
|
ci->cfuncs = funcs;
|
||||||
|
@ -80,10 +79,9 @@ KdScreenInfoAdd (KdCardInfo *ci)
|
||||||
KdScreenInfo *si, **prev;
|
KdScreenInfo *si, **prev;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
si = (KdScreenInfo *) xalloc (sizeof (KdScreenInfo));
|
si = xcalloc (1, sizeof (KdScreenInfo));
|
||||||
if (!si)
|
if (!si)
|
||||||
return 0;
|
return 0;
|
||||||
bzero (si, sizeof (KdScreenInfo));
|
|
||||||
for (prev = &ci->screenList, n = 0; *prev; prev = &(*prev)->next, n++);
|
for (prev = &ci->screenList, n = 0; *prev; prev = &(*prev)->next, n++);
|
||||||
*prev = si;
|
*prev = si;
|
||||||
si->next = 0;
|
si->next = 0;
|
||||||
|
|
|
@ -1127,12 +1127,10 @@ KdGetOptions (InputOption **options, char *string)
|
||||||
InputOption *newopt = NULL, **tmpo = NULL;
|
InputOption *newopt = NULL, **tmpo = NULL;
|
||||||
int tam_key = 0;
|
int tam_key = 0;
|
||||||
|
|
||||||
newopt = (InputOption *) xalloc(sizeof (InputOption));
|
newopt = xcalloc(1, sizeof (InputOption));
|
||||||
if (!newopt)
|
if (!newopt)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
bzero(newopt, sizeof (InputOption));
|
|
||||||
|
|
||||||
for (tmpo = options; *tmpo; tmpo = &(*tmpo)->next)
|
for (tmpo = options; *tmpo; tmpo = &(*tmpo)->next)
|
||||||
; /* Hello, I'm here */
|
; /* Hello, I'm here */
|
||||||
*tmpo = newopt;
|
*tmpo = newopt;
|
||||||
|
|
|
@ -131,11 +131,9 @@ XAACopyPlaneNtoNColorExpand(
|
||||||
h = height = pbox->y2 - pbox->y1;
|
h = height = pbox->y2 - pbox->y1;
|
||||||
pitch = BitmapBytePad(width);
|
pitch = BitmapBytePad(width);
|
||||||
|
|
||||||
if(!(data = xalloc(height * pitch)))
|
if(!(data = xcalloc(height, pitch)))
|
||||||
goto ALLOC_FAILED;
|
goto ALLOC_FAILED;
|
||||||
|
|
||||||
bzero(data, height * pitch);
|
|
||||||
|
|
||||||
dataPtr = data;
|
dataPtr = data;
|
||||||
srcPtr = ((pptSrc->y) * srcwidth) + src +
|
srcPtr = ((pptSrc->y) * srcwidth) + src +
|
||||||
((pptSrc->x) * Bpp) + offset;
|
((pptSrc->x) * Bpp) + offset;
|
||||||
|
|
|
@ -291,8 +291,7 @@ PolyGlyphBltAsSingleBitmap (
|
||||||
|
|
||||||
pitch = (Right - Left + 31) >> 5;
|
pitch = (Right - Left + 31) >> 5;
|
||||||
size = (pitch << 2) * (Bottom - Top);
|
size = (pitch << 2) * (Bottom - Top);
|
||||||
block = (CARD32*)xalloc(size);
|
block = xcalloc(1, size);
|
||||||
bzero(block, size);
|
|
||||||
|
|
||||||
topLine = 10000; botLine = -10000;
|
topLine = 10000; botLine = -10000;
|
||||||
|
|
||||||
|
|
|
@ -317,11 +317,10 @@ miGetPlane(
|
||||||
sy += pDraw->y;
|
sy += pDraw->y;
|
||||||
widthInBytes = BitmapBytePad(w);
|
widthInBytes = BitmapBytePad(w);
|
||||||
if(!result)
|
if(!result)
|
||||||
result = (MiBits *)xalloc(h * widthInBytes);
|
result = xcalloc(h, widthInBytes);
|
||||||
if (!result)
|
if (!result)
|
||||||
return (MiBits *)NULL;
|
return (MiBits *)NULL;
|
||||||
bitsPerPixel = pDraw->bitsPerPixel;
|
bitsPerPixel = pDraw->bitsPerPixel;
|
||||||
bzero((char *)result, h * widthInBytes);
|
|
||||||
pOut = (OUT_TYPE *) result;
|
pOut = (OUT_TYPE *) result;
|
||||||
if(bitsPerPixel == 1)
|
if(bitsPerPixel == 1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -513,10 +513,9 @@ AllocateGlyphSet (int fdepth, PictFormatPtr format)
|
||||||
}
|
}
|
||||||
|
|
||||||
size = sizeof (GlyphSetRec);
|
size = sizeof (GlyphSetRec);
|
||||||
glyphSet = xalloc (size);
|
glyphSet = xcalloc (1, size);
|
||||||
if (!glyphSet)
|
if (!glyphSet)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
bzero((char *)glyphSet, size);
|
|
||||||
|
|
||||||
if (!AllocateGlyphHash (&glyphSet->hash, &glyphHashSets[0]))
|
if (!AllocateGlyphHash (&glyphSet->hash, &glyphHashSets[0]))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1571,21 +1571,19 @@ ProcRenderCreateCursor (ClientPtr client)
|
||||||
|
|
||||||
stride = BitmapBytePad(width);
|
stride = BitmapBytePad(width);
|
||||||
nbytes_mono = stride*height;
|
nbytes_mono = stride*height;
|
||||||
srcbits = (unsigned char *)xalloc(nbytes_mono);
|
srcbits = xcalloc(nbytes_mono);
|
||||||
if (!srcbits)
|
if (!srcbits)
|
||||||
{
|
{
|
||||||
xfree (argbbits);
|
xfree (argbbits);
|
||||||
return (BadAlloc);
|
return (BadAlloc);
|
||||||
}
|
}
|
||||||
mskbits = (unsigned char *)xalloc(nbytes_mono);
|
mskbits = xcalloc(nbytes_mono);
|
||||||
if (!mskbits)
|
if (!mskbits)
|
||||||
{
|
{
|
||||||
xfree(argbbits);
|
xfree(argbbits);
|
||||||
xfree(srcbits);
|
xfree(srcbits);
|
||||||
return (BadAlloc);
|
return (BadAlloc);
|
||||||
}
|
}
|
||||||
bzero ((char *) mskbits, nbytes_mono);
|
|
||||||
bzero ((char *) srcbits, nbytes_mono);
|
|
||||||
|
|
||||||
if (pSrc->format == PICT_a8r8g8b8)
|
if (pSrc->format == PICT_a8r8g8b8)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue