Compare commits
32 Commits
master
...
submit/xal
Author | SHA1 | Date | |
---|---|---|---|
|
a6eec961d8 | ||
|
333bcfd40e | ||
|
529e12fcd2 | ||
|
478653996a | ||
|
39b2354bbc | ||
|
6a1ec27678 | ||
|
75dc221459 | ||
|
ea618f9bff | ||
|
654c7ce1df | ||
|
7f60953188 | ||
|
a3f88ae029 | ||
|
784c0397e5 | ||
|
39278054cb | ||
|
33c0ab942f | ||
|
d481c8311a | ||
|
2263e514c4 | ||
|
85eefbf721 | ||
|
538bfd4acb | ||
|
a51511635c | ||
|
d819be0df9 | ||
|
c7fb5c25bc | ||
|
4b0b459ac0 | ||
|
30c22fb1ba | ||
|
f5f23e8801 | ||
|
9a0388f988 | ||
|
f909106adb | ||
|
6dac1cd970 | ||
|
1f4c810baa | ||
|
ebd36eeb05 | ||
|
349ba2c3f9 | ||
|
ab150e8b52 | ||
|
0263bc7c32 |
|
@ -52,7 +52,7 @@ ht_create(int keySize,
|
||||||
ht->elements = 0;
|
ht->elements = 0;
|
||||||
ht->bucketBits = INITHASHSIZE;
|
ht->bucketBits = INITHASHSIZE;
|
||||||
numBuckets = 1 << ht->bucketBits;
|
numBuckets = 1 << ht->bucketBits;
|
||||||
ht->buckets = xallocarray(numBuckets, sizeof(*ht->buckets));
|
ht->buckets = calloc(numBuckets, sizeof(*ht->buckets));
|
||||||
ht->cdata = cdata;
|
ht->cdata = cdata;
|
||||||
|
|
||||||
if (ht->buckets) {
|
if (ht->buckets) {
|
||||||
|
@ -93,7 +93,7 @@ double_size(HashTable ht)
|
||||||
int newNumBuckets = 1 << newBucketBits;
|
int newNumBuckets = 1 << newBucketBits;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
newBuckets = xallocarray(newNumBuckets, sizeof(*ht->buckets));
|
newBuckets = calloc(newNumBuckets, sizeof(*ht->buckets));
|
||||||
if (newBuckets) {
|
if (newBuckets) {
|
||||||
for (c = 0; c < newNumBuckets; ++c) {
|
for (c = 0; c < newNumBuckets; ++c) {
|
||||||
xorg_list_init(&newBuckets[c]);
|
xorg_list_init(&newBuckets[c]);
|
||||||
|
|
|
@ -1374,7 +1374,6 @@ PanoramiXPolyPoint(ClientPtr client)
|
||||||
{
|
{
|
||||||
PanoramiXRes *gc, *draw;
|
PanoramiXRes *gc, *draw;
|
||||||
int result, npoint, j;
|
int result, npoint, j;
|
||||||
xPoint *origPts;
|
|
||||||
Bool isRoot;
|
Bool isRoot;
|
||||||
|
|
||||||
REQUEST(xPolyPointReq);
|
REQUEST(xPolyPointReq);
|
||||||
|
@ -1397,7 +1396,10 @@ PanoramiXPolyPoint(ClientPtr client)
|
||||||
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
|
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
|
||||||
npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyPointReq));
|
npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyPointReq));
|
||||||
if (npoint > 0) {
|
if (npoint > 0) {
|
||||||
origPts = xallocarray(npoint, sizeof(xPoint));
|
xPoint *origPts = calloc(npoint, sizeof(xPoint));
|
||||||
|
if (!origPts)
|
||||||
|
return BadAlloc;
|
||||||
|
|
||||||
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
|
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
|
||||||
FOR_NSCREENS_FORWARD(j) {
|
FOR_NSCREENS_FORWARD(j) {
|
||||||
|
|
||||||
|
@ -1439,7 +1441,6 @@ PanoramiXPolyLine(ClientPtr client)
|
||||||
{
|
{
|
||||||
PanoramiXRes *gc, *draw;
|
PanoramiXRes *gc, *draw;
|
||||||
int result, npoint, j;
|
int result, npoint, j;
|
||||||
xPoint *origPts;
|
|
||||||
Bool isRoot;
|
Bool isRoot;
|
||||||
|
|
||||||
REQUEST(xPolyLineReq);
|
REQUEST(xPolyLineReq);
|
||||||
|
@ -1462,7 +1463,9 @@ PanoramiXPolyLine(ClientPtr client)
|
||||||
isRoot = IS_ROOT_DRAWABLE(draw);
|
isRoot = IS_ROOT_DRAWABLE(draw);
|
||||||
npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyLineReq));
|
npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyLineReq));
|
||||||
if (npoint > 0) {
|
if (npoint > 0) {
|
||||||
origPts = xallocarray(npoint, sizeof(xPoint));
|
xPoint *origPts = calloc(npoint, sizeof(xPoint));
|
||||||
|
if (!origPts)
|
||||||
|
return BadAlloc;
|
||||||
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
|
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
|
||||||
FOR_NSCREENS_FORWARD(j) {
|
FOR_NSCREENS_FORWARD(j) {
|
||||||
|
|
||||||
|
@ -1504,7 +1507,6 @@ PanoramiXPolySegment(ClientPtr client)
|
||||||
{
|
{
|
||||||
int result, nsegs, i, j;
|
int result, nsegs, i, j;
|
||||||
PanoramiXRes *gc, *draw;
|
PanoramiXRes *gc, *draw;
|
||||||
xSegment *origSegs;
|
|
||||||
Bool isRoot;
|
Bool isRoot;
|
||||||
|
|
||||||
REQUEST(xPolySegmentReq);
|
REQUEST(xPolySegmentReq);
|
||||||
|
@ -1531,7 +1533,9 @@ PanoramiXPolySegment(ClientPtr client)
|
||||||
return BadLength;
|
return BadLength;
|
||||||
nsegs >>= 3;
|
nsegs >>= 3;
|
||||||
if (nsegs > 0) {
|
if (nsegs > 0) {
|
||||||
origSegs = xallocarray(nsegs, sizeof(xSegment));
|
xSegment *origSegs = calloc(nsegs, sizeof(xSegment));
|
||||||
|
if (!origSegs)
|
||||||
|
return BadAlloc;
|
||||||
memcpy((char *) origSegs, (char *) &stuff[1], nsegs * sizeof(xSegment));
|
memcpy((char *) origSegs, (char *) &stuff[1], nsegs * sizeof(xSegment));
|
||||||
FOR_NSCREENS_FORWARD(j) {
|
FOR_NSCREENS_FORWARD(j) {
|
||||||
|
|
||||||
|
@ -1573,7 +1577,6 @@ PanoramiXPolyRectangle(ClientPtr client)
|
||||||
int result, nrects, i, j;
|
int result, nrects, i, j;
|
||||||
PanoramiXRes *gc, *draw;
|
PanoramiXRes *gc, *draw;
|
||||||
Bool isRoot;
|
Bool isRoot;
|
||||||
xRectangle *origRecs;
|
|
||||||
|
|
||||||
REQUEST(xPolyRectangleReq);
|
REQUEST(xPolyRectangleReq);
|
||||||
|
|
||||||
|
@ -1599,7 +1602,9 @@ PanoramiXPolyRectangle(ClientPtr client)
|
||||||
return BadLength;
|
return BadLength;
|
||||||
nrects >>= 3;
|
nrects >>= 3;
|
||||||
if (nrects > 0) {
|
if (nrects > 0) {
|
||||||
origRecs = xallocarray(nrects, sizeof(xRectangle));
|
xRectangle *origRecs = calloc(nrects, sizeof(xRectangle));
|
||||||
|
if (!origRecs)
|
||||||
|
return BadAlloc;
|
||||||
memcpy((char *) origRecs, (char *) &stuff[1],
|
memcpy((char *) origRecs, (char *) &stuff[1],
|
||||||
nrects * sizeof(xRectangle));
|
nrects * sizeof(xRectangle));
|
||||||
FOR_NSCREENS_FORWARD(j) {
|
FOR_NSCREENS_FORWARD(j) {
|
||||||
|
@ -1640,7 +1645,6 @@ PanoramiXPolyArc(ClientPtr client)
|
||||||
int result, narcs, i, j;
|
int result, narcs, i, j;
|
||||||
PanoramiXRes *gc, *draw;
|
PanoramiXRes *gc, *draw;
|
||||||
Bool isRoot;
|
Bool isRoot;
|
||||||
xArc *origArcs;
|
|
||||||
|
|
||||||
REQUEST(xPolyArcReq);
|
REQUEST(xPolyArcReq);
|
||||||
|
|
||||||
|
@ -1666,7 +1670,9 @@ PanoramiXPolyArc(ClientPtr client)
|
||||||
return BadLength;
|
return BadLength;
|
||||||
narcs /= sizeof(xArc);
|
narcs /= sizeof(xArc);
|
||||||
if (narcs > 0) {
|
if (narcs > 0) {
|
||||||
origArcs = xallocarray(narcs, sizeof(xArc));
|
xArc *origArcs = calloc(narcs, sizeof(xArc));
|
||||||
|
if (!origArcs)
|
||||||
|
return BadAlloc;
|
||||||
memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
|
memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
|
||||||
FOR_NSCREENS_FORWARD(j) {
|
FOR_NSCREENS_FORWARD(j) {
|
||||||
|
|
||||||
|
@ -1705,7 +1711,6 @@ PanoramiXFillPoly(ClientPtr client)
|
||||||
int result, count, j;
|
int result, count, j;
|
||||||
PanoramiXRes *gc, *draw;
|
PanoramiXRes *gc, *draw;
|
||||||
Bool isRoot;
|
Bool isRoot;
|
||||||
DDXPointPtr locPts;
|
|
||||||
|
|
||||||
REQUEST(xFillPolyReq);
|
REQUEST(xFillPolyReq);
|
||||||
|
|
||||||
|
@ -1728,7 +1733,9 @@ PanoramiXFillPoly(ClientPtr client)
|
||||||
|
|
||||||
count = bytes_to_int32((client->req_len << 2) - sizeof(xFillPolyReq));
|
count = bytes_to_int32((client->req_len << 2) - sizeof(xFillPolyReq));
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
locPts = xallocarray(count, sizeof(DDXPointRec));
|
DDXPointPtr locPts = calloc(count, sizeof(DDXPointRec));
|
||||||
|
if (!locPts)
|
||||||
|
return BadAlloc;
|
||||||
memcpy((char *) locPts, (char *) &stuff[1],
|
memcpy((char *) locPts, (char *) &stuff[1],
|
||||||
count * sizeof(DDXPointRec));
|
count * sizeof(DDXPointRec));
|
||||||
FOR_NSCREENS_FORWARD(j) {
|
FOR_NSCREENS_FORWARD(j) {
|
||||||
|
@ -1771,8 +1778,6 @@ PanoramiXPolyFillRectangle(ClientPtr client)
|
||||||
int result, things, i, j;
|
int result, things, i, j;
|
||||||
PanoramiXRes *gc, *draw;
|
PanoramiXRes *gc, *draw;
|
||||||
Bool isRoot;
|
Bool isRoot;
|
||||||
xRectangle *origRects;
|
|
||||||
|
|
||||||
REQUEST(xPolyFillRectangleReq);
|
REQUEST(xPolyFillRectangleReq);
|
||||||
|
|
||||||
REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq);
|
REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq);
|
||||||
|
@ -1797,7 +1802,9 @@ PanoramiXPolyFillRectangle(ClientPtr client)
|
||||||
return BadLength;
|
return BadLength;
|
||||||
things >>= 3;
|
things >>= 3;
|
||||||
if (things > 0) {
|
if (things > 0) {
|
||||||
origRects = xallocarray(things, sizeof(xRectangle));
|
xRectangle *origRects = calloc(things, sizeof(xRectangle));
|
||||||
|
if (!origRects)
|
||||||
|
return BadAlloc;
|
||||||
memcpy((char *) origRects, (char *) &stuff[1],
|
memcpy((char *) origRects, (char *) &stuff[1],
|
||||||
things * sizeof(xRectangle));
|
things * sizeof(xRectangle));
|
||||||
FOR_NSCREENS_FORWARD(j) {
|
FOR_NSCREENS_FORWARD(j) {
|
||||||
|
@ -1838,7 +1845,6 @@ PanoramiXPolyFillArc(ClientPtr client)
|
||||||
PanoramiXRes *gc, *draw;
|
PanoramiXRes *gc, *draw;
|
||||||
Bool isRoot;
|
Bool isRoot;
|
||||||
int result, narcs, i, j;
|
int result, narcs, i, j;
|
||||||
xArc *origArcs;
|
|
||||||
|
|
||||||
REQUEST(xPolyFillArcReq);
|
REQUEST(xPolyFillArcReq);
|
||||||
|
|
||||||
|
@ -1864,7 +1870,9 @@ PanoramiXPolyFillArc(ClientPtr client)
|
||||||
return BadLength;
|
return BadLength;
|
||||||
narcs /= sizeof(xArc);
|
narcs /= sizeof(xArc);
|
||||||
if (narcs > 0) {
|
if (narcs > 0) {
|
||||||
origArcs = xallocarray(narcs, sizeof(xArc));
|
xArc *origArcs = calloc(narcs, sizeof(xArc));
|
||||||
|
if (!origArcs)
|
||||||
|
return BadAlloc;
|
||||||
memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
|
memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
|
||||||
FOR_NSCREENS_FORWARD(j) {
|
FOR_NSCREENS_FORWARD(j) {
|
||||||
|
|
||||||
|
@ -2050,7 +2058,7 @@ PanoramiXGetImage(ClientPtr client)
|
||||||
if (linesPerBuf > h)
|
if (linesPerBuf > h)
|
||||||
linesPerBuf = h;
|
linesPerBuf = h;
|
||||||
}
|
}
|
||||||
if (!(pBuf = xallocarray(linesPerBuf, widthBytesLine)))
|
if (!(pBuf = calloc(linesPerBuf, widthBytesLine)))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
WriteReplyToClient(client, sizeof(xGetImageReply), &xgi);
|
WriteReplyToClient(client, sizeof(xGetImageReply), &xgi);
|
||||||
|
|
|
@ -828,7 +828,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
/* over allocate for override redirect */
|
/* over allocate for override redirect */
|
||||||
pAttr->values = values = xallocarray(len + 1, sizeof(unsigned long));
|
pAttr->values = values = calloc(len + 1, sizeof(unsigned long));
|
||||||
if (!values) {
|
if (!values) {
|
||||||
ret = BadAlloc;
|
ret = BadAlloc;
|
||||||
goto bail;
|
goto bail;
|
||||||
|
|
|
@ -991,7 +991,7 @@ ProcShapeGetRectangles(ClientPtr client)
|
||||||
|
|
||||||
nrects = RegionNumRects(region);
|
nrects = RegionNumRects(region);
|
||||||
box = RegionRects(region);
|
box = RegionRects(region);
|
||||||
rects = xallocarray(nrects, sizeof(xRectangle));
|
rects = calloc(nrects, sizeof(xRectangle));
|
||||||
if (!rects && nrects)
|
if (!rects && nrects)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
for (i = 0; i < nrects; i++, box++) {
|
for (i = 0; i < nrects; i++, box++) {
|
||||||
|
|
|
@ -650,7 +650,7 @@ SyncAwaitTriggerFired(SyncTrigger * pTrigger)
|
||||||
|
|
||||||
pAwaitUnion = (SyncAwaitUnion *) pAwait->pHeader;
|
pAwaitUnion = (SyncAwaitUnion *) pAwait->pHeader;
|
||||||
numwaits = pAwaitUnion->header.num_waitconditions;
|
numwaits = pAwaitUnion->header.num_waitconditions;
|
||||||
ppAwait = xallocarray(numwaits, sizeof(SyncAwait *));
|
ppAwait = calloc(numwaits, sizeof(SyncAwait *));
|
||||||
if (!ppAwait)
|
if (!ppAwait)
|
||||||
goto bail;
|
goto bail;
|
||||||
|
|
||||||
|
@ -1547,7 +1547,7 @@ SyncAwaitPrologue(ClientPtr client, int items)
|
||||||
/* all the memory for the entire await list is allocated
|
/* all the memory for the entire await list is allocated
|
||||||
* here in one chunk
|
* here in one chunk
|
||||||
*/
|
*/
|
||||||
pAwaitUnion = xallocarray(items + 1, sizeof(SyncAwaitUnion));
|
pAwaitUnion = calloc(items + 1, sizeof(SyncAwaitUnion));
|
||||||
if (!pAwaitUnion)
|
if (!pAwaitUnion)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
|
@ -1198,11 +1198,11 @@ ProcVidModeGetMonitor(ClientPtr client)
|
||||||
pad_to_int32(rep.modelLength));
|
pad_to_int32(rep.modelLength));
|
||||||
rep.nhsync = nHsync;
|
rep.nhsync = nHsync;
|
||||||
rep.nvsync = nVrefresh;
|
rep.nvsync = nVrefresh;
|
||||||
hsyncdata = xallocarray(nHsync, sizeof(CARD32));
|
hsyncdata = calloc(nHsync, sizeof(CARD32));
|
||||||
if (!hsyncdata) {
|
if (!hsyncdata) {
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
vsyncdata = xallocarray(nVrefresh, sizeof(CARD32));
|
vsyncdata = calloc(nVrefresh, sizeof(CARD32));
|
||||||
|
|
||||||
if (!vsyncdata) {
|
if (!vsyncdata) {
|
||||||
free(hsyncdata);
|
free(hsyncdata);
|
||||||
|
@ -1520,7 +1520,7 @@ ProcVidModeGetGammaRamp(ClientPtr client)
|
||||||
length = (stuff->size + 1) & ~1;
|
length = (stuff->size + 1) & ~1;
|
||||||
|
|
||||||
if (stuff->size) {
|
if (stuff->size) {
|
||||||
if (!(ramp = xallocarray(length, 3 * sizeof(CARD16))))
|
if (!(ramp = calloc(length, 3 * sizeof(CARD16))))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
ramplen = length * 3 * sizeof(CARD16);
|
ramplen = length * 3 * sizeof(CARD16);
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ ProcXCMiscGetXIDList(ClientPtr client)
|
||||||
if (stuff->count > UINT32_MAX / sizeof(XID))
|
if (stuff->count > UINT32_MAX / sizeof(XID))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
pids = xallocarray(stuff->count, sizeof(XID));
|
pids = calloc(stuff->count, sizeof(XID));
|
||||||
if (!pids) {
|
if (!pids) {
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -390,7 +390,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#endif
|
#endif
|
||||||
pCI = xallocarray(nCharInfos, sizeof(xCharInfo));
|
pCI = calloc(nCharInfos, sizeof(xCharInfo));
|
||||||
if (!pCI)
|
if (!pCI)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
#ifdef MITSHM
|
#ifdef MITSHM
|
||||||
|
@ -452,7 +452,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
|
||||||
if (hashModulus > nCharInfos + 1)
|
if (hashModulus > nCharInfos + 1)
|
||||||
hashModulus = nCharInfos + 1;
|
hashModulus = nCharInfos + 1;
|
||||||
|
|
||||||
tmp = xallocarray(4 * nCharInfos + 1, sizeof(CARD16));
|
tmp = calloc(4 * nCharInfos + 1, sizeof(CARD16));
|
||||||
if (!tmp) {
|
if (!tmp) {
|
||||||
if (!pDesc)
|
if (!pDesc)
|
||||||
free(pCI);
|
free(pCI);
|
||||||
|
|
10
Xext/xres.c
10
Xext/xres.c
|
@ -220,12 +220,13 @@ ProcXResQueryClients(ClientPtr client)
|
||||||
{
|
{
|
||||||
/* REQUEST(xXResQueryClientsReq); */
|
/* REQUEST(xXResQueryClientsReq); */
|
||||||
xXResQueryClientsReply rep;
|
xXResQueryClientsReply rep;
|
||||||
int *current_clients;
|
|
||||||
int i, num_clients;
|
int i, num_clients;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXResQueryClientsReq);
|
REQUEST_SIZE_MATCH(xXResQueryClientsReq);
|
||||||
|
|
||||||
current_clients = xallocarray(currentMaxClients, sizeof(int));
|
int *current_clients = calloc(currentMaxClients, sizeof(int));
|
||||||
|
if (!current_clients)
|
||||||
|
return BadAlloc;
|
||||||
|
|
||||||
num_clients = 0;
|
num_clients = 0;
|
||||||
for (i = 0; i < currentMaxClients; i++) {
|
for (i = 0; i < currentMaxClients; i++) {
|
||||||
|
@ -300,7 +301,6 @@ ProcXResQueryClientResources(ClientPtr client)
|
||||||
REQUEST(xXResQueryClientResourcesReq);
|
REQUEST(xXResQueryClientResourcesReq);
|
||||||
xXResQueryClientResourcesReply rep;
|
xXResQueryClientResourcesReply rep;
|
||||||
int i, clientID, num_types;
|
int i, clientID, num_types;
|
||||||
int *counts;
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXResQueryClientResourcesReq);
|
REQUEST_SIZE_MATCH(xXResQueryClientResourcesReq);
|
||||||
|
|
||||||
|
@ -311,7 +311,9 @@ ProcXResQueryClientResources(ClientPtr client)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
counts = calloc(lastResourceType + 1, sizeof(int));
|
int *counts = calloc(lastResourceType + 1, sizeof(int));
|
||||||
|
if (!counts)
|
||||||
|
return BadAlloc;
|
||||||
|
|
||||||
FindAllClientResources(clients[clientID], ResFindAllRes, counts);
|
FindAllClientResources(clients[clientID], ResFindAllRes, counts);
|
||||||
|
|
||||||
|
|
|
@ -1083,7 +1083,7 @@ XvFillColorKey(DrawablePtr pDraw, CARD32 key, RegionPtr region)
|
||||||
(void) ChangeGC(NullClient, gc, GCForeground | GCSubwindowMode, pval);
|
(void) ChangeGC(NullClient, gc, GCForeground | GCSubwindowMode, pval);
|
||||||
ValidateGC(pDraw, gc);
|
ValidateGC(pDraw, gc);
|
||||||
|
|
||||||
rects = xallocarray(nbox, sizeof(xRectangle));
|
rects = calloc(nbox, sizeof(xRectangle));
|
||||||
if (rects) {
|
if (rects) {
|
||||||
for (i = 0; i < nbox; i++, pbox++) {
|
for (i = 0; i < nbox; i++, pbox++) {
|
||||||
rects[i].x = pbox->x1 - pDraw->x;
|
rects[i].x = pbox->x1 - pDraw->x;
|
||||||
|
|
|
@ -117,7 +117,9 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
|
||||||
ClassFromMask(NULL, others->dontPropagateMask[i], i, &count, COUNT);
|
ClassFromMask(NULL, others->dontPropagateMask[i], i, &count, COUNT);
|
||||||
if (count) {
|
if (count) {
|
||||||
rep.count = count;
|
rep.count = count;
|
||||||
buf = xallocarray(rep.count, sizeof(XEventClass));
|
buf = calloc(rep.count, sizeof(XEventClass));
|
||||||
|
if (!buf)
|
||||||
|
return BadAlloc;
|
||||||
rep.length = bytes_to_int32(rep.count * sizeof(XEventClass));
|
rep.length = bytes_to_int32(rep.count * sizeof(XEventClass));
|
||||||
|
|
||||||
tbuf = buf;
|
tbuf = buf;
|
||||||
|
|
|
@ -221,7 +221,7 @@ list_atoms(DeviceIntPtr dev, int *natoms, Atom **atoms_return)
|
||||||
if (nprops) {
|
if (nprops) {
|
||||||
Atom *a;
|
Atom *a;
|
||||||
|
|
||||||
atoms = xallocarray(nprops, sizeof(Atom));
|
atoms = calloc(nprops, sizeof(Atom));
|
||||||
if (!atoms)
|
if (!atoms)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
a = atoms;
|
a = atoms;
|
||||||
|
@ -724,7 +724,7 @@ XIChangeDeviceProperty(DeviceIntPtr dev, Atom property, Atom type,
|
||||||
if (mode == PropModeReplace || len > 0) {
|
if (mode == PropModeReplace || len > 0) {
|
||||||
void *new_data = NULL, *old_data = NULL;
|
void *new_data = NULL, *old_data = NULL;
|
||||||
|
|
||||||
new_value.data = xallocarray(total_len, size_in_bytes);
|
new_value.data = calloc(total_len, size_in_bytes);
|
||||||
if (!new_value.data && total_len && size_in_bytes) {
|
if (!new_value.data && total_len && size_in_bytes) {
|
||||||
if (add)
|
if (add)
|
||||||
XIDestroyDeviceProperty(prop);
|
XIDestroyDeviceProperty(prop);
|
||||||
|
|
|
@ -470,7 +470,7 @@ ProcDbeSwapBuffers(ClientPtr client)
|
||||||
dbeSwapInfo = (xDbeSwapInfo *) &stuff[1];
|
dbeSwapInfo = (xDbeSwapInfo *) &stuff[1];
|
||||||
|
|
||||||
/* Allocate array to record swap information. */
|
/* Allocate array to record swap information. */
|
||||||
swapInfo = xallocarray(nStuff, sizeof(DbeSwapInfoRec));
|
swapInfo = calloc(nStuff, sizeof(DbeSwapInfoRec));
|
||||||
if (swapInfo == NULL) {
|
if (swapInfo == NULL) {
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
@ -583,7 +583,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
/* Make sure any specified drawables are valid. */
|
/* Make sure any specified drawables are valid. */
|
||||||
if (stuff->n != 0) {
|
if (stuff->n != 0) {
|
||||||
if (!(pDrawables = xallocarray(stuff->n, sizeof(DrawablePtr)))) {
|
if (!(pDrawables = calloc(stuff->n, sizeof(DrawablePtr)))) {
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ miDbeGetVisualInfo(ScreenPtr pScreen, XdbeScreenVisualInfo * pScrVisInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate an array of XdbeVisualInfo items. */
|
/* Allocate an array of XdbeVisualInfo items. */
|
||||||
if (!(visInfo = xallocarray(count, sizeof(XdbeVisualInfo)))) {
|
if (!(visInfo = calloc(count, sizeof(XdbeVisualInfo)))) {
|
||||||
return FALSE; /* memory alloc failure */
|
return FALSE; /* memory alloc failure */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -199,7 +199,7 @@ InitAtoms(void)
|
||||||
{
|
{
|
||||||
FreeAllAtoms();
|
FreeAllAtoms();
|
||||||
tableLength = InitialTableSize;
|
tableLength = InitialTableSize;
|
||||||
nodeTable = xallocarray(InitialTableSize, sizeof(NodePtr));
|
nodeTable = calloc(InitialTableSize, sizeof(NodePtr));
|
||||||
if (!nodeTable)
|
if (!nodeTable)
|
||||||
AtomError();
|
AtomError();
|
||||||
nodeTable[None] = NULL;
|
nodeTable[None] = NULL;
|
||||||
|
|
|
@ -308,7 +308,7 @@ CreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
|
||||||
for (pent = &pmap->red[size - 1]; pent >= pmap->red; pent--)
|
for (pent = &pmap->red[size - 1]; pent >= pmap->red; pent--)
|
||||||
pent->refcnt = AllocPrivate;
|
pent->refcnt = AllocPrivate;
|
||||||
pmap->freeRed = 0;
|
pmap->freeRed = 0;
|
||||||
ppix = xallocarray(size, sizeof(Pixel));
|
ppix = calloc(size, sizeof(Pixel));
|
||||||
if (!ppix) {
|
if (!ppix) {
|
||||||
free(pmap);
|
free(pmap);
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
@ -349,7 +349,7 @@ CreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
|
||||||
for (pent = &pmap->green[size - 1]; pent >= pmap->green; pent--)
|
for (pent = &pmap->green[size - 1]; pent >= pmap->green; pent--)
|
||||||
pent->refcnt = AllocPrivate;
|
pent->refcnt = AllocPrivate;
|
||||||
pmap->freeGreen = 0;
|
pmap->freeGreen = 0;
|
||||||
ppix = xallocarray(size, sizeof(Pixel));
|
ppix = calloc(size, sizeof(Pixel));
|
||||||
if (!ppix) {
|
if (!ppix) {
|
||||||
free(pmap->clientPixelsRed[client]);
|
free(pmap->clientPixelsRed[client]);
|
||||||
free(pmap);
|
free(pmap);
|
||||||
|
@ -364,7 +364,7 @@ CreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
|
||||||
for (pent = &pmap->blue[size - 1]; pent >= pmap->blue; pent--)
|
for (pent = &pmap->blue[size - 1]; pent >= pmap->blue; pent--)
|
||||||
pent->refcnt = AllocPrivate;
|
pent->refcnt = AllocPrivate;
|
||||||
pmap->freeBlue = 0;
|
pmap->freeBlue = 0;
|
||||||
ppix = xallocarray(size, sizeof(Pixel));
|
ppix = calloc(size, sizeof(Pixel));
|
||||||
if (!ppix) {
|
if (!ppix) {
|
||||||
free(pmap->clientPixelsGreen[client]);
|
free(pmap->clientPixelsGreen[client]);
|
||||||
free(pmap->clientPixelsRed[client]);
|
free(pmap->clientPixelsRed[client]);
|
||||||
|
@ -714,7 +714,7 @@ doUpdateColors(ColormapPtr pmap)
|
||||||
|
|
||||||
pVisual = pmap->pVisual;
|
pVisual = pmap->pVisual;
|
||||||
size = pVisual->ColormapEntries;
|
size = pVisual->ColormapEntries;
|
||||||
defs = xallocarray(size, sizeof(xColorItem));
|
defs = calloc(size, sizeof(xColorItem));
|
||||||
if (!defs)
|
if (!defs)
|
||||||
return;
|
return;
|
||||||
n = 0;
|
n = 0;
|
||||||
|
@ -1660,9 +1660,9 @@ AllocDirect(int client, ColormapPtr pmap, int c, int r, int g, int b,
|
||||||
for (p = pixels; p < pixels + c; p++)
|
for (p = pixels; p < pixels + c; p++)
|
||||||
*p = 0;
|
*p = 0;
|
||||||
|
|
||||||
ppixRed = xallocarray(npixR, sizeof(Pixel));
|
ppixRed = calloc(npixR, sizeof(Pixel));
|
||||||
ppixGreen = xallocarray(npixG, sizeof(Pixel));
|
ppixGreen = calloc(npixG, sizeof(Pixel));
|
||||||
ppixBlue = xallocarray(npixB, sizeof(Pixel));
|
ppixBlue = calloc(npixB, sizeof(Pixel));
|
||||||
if (!ppixRed || !ppixGreen || !ppixBlue) {
|
if (!ppixRed || !ppixGreen || !ppixBlue) {
|
||||||
free(ppixBlue);
|
free(ppixBlue);
|
||||||
free(ppixGreen);
|
free(ppixGreen);
|
||||||
|
@ -1760,7 +1760,7 @@ AllocPseudo(int client, ColormapPtr pmap, int c, int r, Bool contig,
|
||||||
npix = c << r;
|
npix = c << r;
|
||||||
if ((r >= 32) || (npix > pmap->freeRed) || (npix < c))
|
if ((r >= 32) || (npix > pmap->freeRed) || (npix < c))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
if (!(ppixTemp = xallocarray(npix, sizeof(Pixel))))
|
if (!(ppixTemp = calloc(npix, sizeof(Pixel))))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
ok = AllocCP(pmap, pmap->red, c, r, contig, ppixTemp, pmask);
|
ok = AllocCP(pmap, pmap->red, c, r, contig, ppixTemp, pmask);
|
||||||
|
|
||||||
|
@ -1972,7 +1972,7 @@ AllocShared(ColormapPtr pmap, Pixel * ppix, int c, int r, int g, int b,
|
||||||
|
|
||||||
npixClientNew = c << (r + g + b);
|
npixClientNew = c << (r + g + b);
|
||||||
npixShared = (c << r) + (c << g) + (c << b);
|
npixShared = (c << r) + (c << g) + (c << b);
|
||||||
psharedList = xallocarray(npixShared, sizeof(SHAREDCOLOR *));
|
psharedList = calloc(npixShared, sizeof(SHAREDCOLOR *));
|
||||||
if (!psharedList)
|
if (!psharedList)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
ppshared = psharedList;
|
ppshared = psharedList;
|
||||||
|
@ -2481,8 +2481,8 @@ IsMapInstalled(Colormap map, WindowPtr pWin)
|
||||||
Colormap *pmaps;
|
Colormap *pmaps;
|
||||||
int imap, nummaps, found;
|
int imap, nummaps, found;
|
||||||
|
|
||||||
pmaps = xallocarray(pWin->drawable.pScreen->maxInstalledCmaps,
|
pmaps = calloc(pWin->drawable.pScreen->maxInstalledCmaps,
|
||||||
sizeof(Colormap));
|
sizeof(Colormap));
|
||||||
if (!pmaps)
|
if (!pmaps)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
nummaps = (*pWin->drawable.pScreen->ListInstalledColormaps)
|
nummaps = (*pWin->drawable.pScreen->ListInstalledColormaps)
|
||||||
|
|
|
@ -285,6 +285,10 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
|
||||||
dev->deviceGrab.ActivateGrab = ActivateKeyboardGrab;
|
dev->deviceGrab.ActivateGrab = ActivateKeyboardGrab;
|
||||||
dev->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab;
|
dev->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab;
|
||||||
dev->deviceGrab.sync.event = calloc(1, sizeof(InternalEvent));
|
dev->deviceGrab.sync.event = calloc(1, sizeof(InternalEvent));
|
||||||
|
if (!(dev->deviceGrab.sync.event)) {
|
||||||
|
free(dev);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
dev->sendEventsProc = XTestDeviceSendEvents;
|
dev->sendEventsProc = XTestDeviceSendEvents;
|
||||||
|
|
||||||
|
@ -1554,8 +1558,8 @@ InitStringFeedbackClassDeviceStruct(DeviceIntPtr dev,
|
||||||
feedc->ctrl.num_symbols_displayed = 0;
|
feedc->ctrl.num_symbols_displayed = 0;
|
||||||
feedc->ctrl.max_symbols = max_symbols;
|
feedc->ctrl.max_symbols = max_symbols;
|
||||||
feedc->ctrl.symbols_supported =
|
feedc->ctrl.symbols_supported =
|
||||||
xallocarray(num_symbols_supported, sizeof(KeySym));
|
calloc(num_symbols_supported, sizeof(KeySym));
|
||||||
feedc->ctrl.symbols_displayed = xallocarray(max_symbols, sizeof(KeySym));
|
feedc->ctrl.symbols_displayed = calloc(max_symbols, sizeof(KeySym));
|
||||||
if (!feedc->ctrl.symbols_supported || !feedc->ctrl.symbols_displayed) {
|
if (!feedc->ctrl.symbols_supported || !feedc->ctrl.symbols_displayed) {
|
||||||
free(feedc->ctrl.symbols_supported);
|
free(feedc->ctrl.symbols_supported);
|
||||||
free(feedc->ctrl.symbols_displayed);
|
free(feedc->ctrl.symbols_displayed);
|
||||||
|
@ -1704,6 +1708,8 @@ InitTouchClassDeviceStruct(DeviceIntPtr device, unsigned int max_touches,
|
||||||
|
|
||||||
device->touch = touch;
|
device->touch = touch;
|
||||||
device->last.touches = calloc(max_touches, sizeof(*device->last.touches));
|
device->last.touches = calloc(max_touches, sizeof(*device->last.touches));
|
||||||
|
if (!(device->last.touches))
|
||||||
|
goto err;
|
||||||
device->last.num_touches = touch->num_touches;
|
device->last.num_touches = touch->num_touches;
|
||||||
for (i = 0; i < touch->num_touches; i++)
|
for (i = 0; i < touch->num_touches; i++)
|
||||||
TouchInitDDXTouchPoint(device, &device->last.touches[i]);
|
TouchInitDDXTouchPoint(device, &device->last.touches[i]);
|
||||||
|
@ -2800,8 +2806,8 @@ AllocDevicePair(ClientPtr client, const char *name,
|
||||||
DeviceIntPtr *keybd,
|
DeviceIntPtr *keybd,
|
||||||
DeviceProc ptr_proc, DeviceProc keybd_proc, Bool master)
|
DeviceProc ptr_proc, DeviceProc keybd_proc, Bool master)
|
||||||
{
|
{
|
||||||
DeviceIntPtr pointer;
|
DeviceIntPtr pointer = NULL;
|
||||||
DeviceIntPtr keyboard;
|
DeviceIntPtr keyboard = NULL;
|
||||||
char *dev_name;
|
char *dev_name;
|
||||||
|
|
||||||
*ptr = *keybd = NULL;
|
*ptr = *keybd = NULL;
|
||||||
|
@ -2809,15 +2815,12 @@ AllocDevicePair(ClientPtr client, const char *name,
|
||||||
XkbInitPrivates();
|
XkbInitPrivates();
|
||||||
|
|
||||||
pointer = AddInputDevice(client, ptr_proc, TRUE);
|
pointer = AddInputDevice(client, ptr_proc, TRUE);
|
||||||
|
|
||||||
if (!pointer)
|
if (!pointer)
|
||||||
return BadAlloc;
|
goto badalloc;
|
||||||
|
|
||||||
if (asprintf(&dev_name, "%s pointer", name) == -1) {
|
if (asprintf(&dev_name, "%s pointer", name) == -1)
|
||||||
RemoveDevice(pointer, FALSE);
|
goto badalloc;
|
||||||
|
|
||||||
return BadAlloc;
|
|
||||||
}
|
|
||||||
pointer->name = dev_name;
|
pointer->name = dev_name;
|
||||||
|
|
||||||
pointer->public.processInputProc = ProcessOtherEvent;
|
pointer->public.processInputProc = ProcessOtherEvent;
|
||||||
|
@ -2833,18 +2836,12 @@ AllocDevicePair(ClientPtr client, const char *name,
|
||||||
pointer->type = (master) ? MASTER_POINTER : SLAVE;
|
pointer->type = (master) ? MASTER_POINTER : SLAVE;
|
||||||
|
|
||||||
keyboard = AddInputDevice(client, keybd_proc, TRUE);
|
keyboard = AddInputDevice(client, keybd_proc, TRUE);
|
||||||
if (!keyboard) {
|
if (!keyboard)
|
||||||
RemoveDevice(pointer, FALSE);
|
goto badalloc;
|
||||||
|
|
||||||
return BadAlloc;
|
if (asprintf(&dev_name, "%s keyboard", name) == -1)
|
||||||
}
|
goto badalloc;
|
||||||
|
|
||||||
if (asprintf(&dev_name, "%s keyboard", name) == -1) {
|
|
||||||
RemoveDevice(keyboard, FALSE);
|
|
||||||
RemoveDevice(pointer, FALSE);
|
|
||||||
|
|
||||||
return BadAlloc;
|
|
||||||
}
|
|
||||||
keyboard->name = dev_name;
|
keyboard->name = dev_name;
|
||||||
|
|
||||||
keyboard->public.processInputProc = ProcessOtherEvent;
|
keyboard->public.processInputProc = ProcessOtherEvent;
|
||||||
|
@ -2863,6 +2860,8 @@ AllocDevicePair(ClientPtr client, const char *name,
|
||||||
if (IsMaster(pointer)) {
|
if (IsMaster(pointer)) {
|
||||||
pointer->unused_classes = calloc(1, sizeof(ClassesRec));
|
pointer->unused_classes = calloc(1, sizeof(ClassesRec));
|
||||||
keyboard->unused_classes = calloc(1, sizeof(ClassesRec));
|
keyboard->unused_classes = calloc(1, sizeof(ClassesRec));
|
||||||
|
if (!pointer->unused_classes || !keyboard->unused_classes)
|
||||||
|
goto badalloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
*ptr = pointer;
|
*ptr = pointer;
|
||||||
|
@ -2870,6 +2869,12 @@ AllocDevicePair(ClientPtr client, const char *name,
|
||||||
*keybd = keyboard;
|
*keybd = keyboard;
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
|
|
||||||
|
badalloc:
|
||||||
|
// safe to call them even with NULL pointer
|
||||||
|
RemoveDevice(keyboard, FALSE);
|
||||||
|
RemoveDevice(pointer, FALSE);
|
||||||
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1089,7 +1089,7 @@ ProcQueryTree(ClientPtr client)
|
||||||
if (numChildren) {
|
if (numChildren) {
|
||||||
int curChild = 0;
|
int curChild = 0;
|
||||||
|
|
||||||
childIDs = xallocarray(numChildren, sizeof(Window));
|
childIDs = calloc(numChildren, sizeof(Window));
|
||||||
if (!childIDs)
|
if (!childIDs)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
for (pChild = pWin->lastChild; pChild != pHead;
|
for (pChild = pWin->lastChild; pChild != pHead;
|
||||||
|
|
|
@ -426,7 +426,7 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname,
|
||||||
* copy the current FPE list, so that if it gets changed by another client
|
* copy the current FPE list, so that if it gets changed by another client
|
||||||
* while we're blocking, the request still appears atomic
|
* while we're blocking, the request still appears atomic
|
||||||
*/
|
*/
|
||||||
c->fpe_list = xallocarray(num_fpes, sizeof(FontPathElementPtr));
|
c->fpe_list = calloc(num_fpes, sizeof(FontPathElementPtr));
|
||||||
if (!c->fpe_list) {
|
if (!c->fpe_list) {
|
||||||
free((void *) c->fontname);
|
free((void *) c->fontname);
|
||||||
free(c);
|
free(c);
|
||||||
|
@ -816,7 +816,7 @@ ListFonts(ClientPtr client, unsigned char *pattern, unsigned length,
|
||||||
|
|
||||||
if (!(c = malloc(sizeof *c)))
|
if (!(c = malloc(sizeof *c)))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
c->fpe_list = xallocarray(num_fpes, sizeof(FontPathElementPtr));
|
c->fpe_list = calloc(num_fpes, sizeof(FontPathElementPtr));
|
||||||
if (!c->fpe_list) {
|
if (!c->fpe_list) {
|
||||||
free(c);
|
free(c);
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
@ -1062,7 +1062,7 @@ StartListFontsWithInfo(ClientPtr client, int length, unsigned char *pattern,
|
||||||
|
|
||||||
if (!(c = malloc(sizeof *c)))
|
if (!(c = malloc(sizeof *c)))
|
||||||
goto badAlloc;
|
goto badAlloc;
|
||||||
c->fpe_list = xallocarray(num_fpes, sizeof(FontPathElementPtr));
|
c->fpe_list = calloc(num_fpes, sizeof(FontPathElementPtr));
|
||||||
if (!c->fpe_list) {
|
if (!c->fpe_list) {
|
||||||
free(c);
|
free(c);
|
||||||
goto badAlloc;
|
goto badAlloc;
|
||||||
|
@ -1428,7 +1428,7 @@ doImageText(ClientPtr client, ITclosurePtr c)
|
||||||
*new_closure = *c;
|
*new_closure = *c;
|
||||||
c = new_closure;
|
c = new_closure;
|
||||||
|
|
||||||
data = xallocarray(c->nChars, itemSize);
|
data = calloc(c->nChars, itemSize);
|
||||||
if (!data) {
|
if (!data) {
|
||||||
free(c);
|
free(c);
|
||||||
c = old_closure;
|
c = old_closure;
|
||||||
|
@ -1581,7 +1581,7 @@ SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist)
|
||||||
unsigned char *cp = paths;
|
unsigned char *cp = paths;
|
||||||
FontPathElementPtr fpe = NULL, *fplist;
|
FontPathElementPtr fpe = NULL, *fplist;
|
||||||
|
|
||||||
fplist = xallocarray(npaths, sizeof(FontPathElementPtr));
|
fplist = calloc(npaths, sizeof(FontPathElementPtr));
|
||||||
if (!fplist) {
|
if (!fplist) {
|
||||||
*bad = 0;
|
*bad = 0;
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
|
@ -599,10 +599,10 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
|
||||||
i++;
|
i++;
|
||||||
if (!i)
|
if (!i)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
deletes = xallocarray(i, sizeof(GrabPtr));
|
deletes = calloc(i, sizeof(GrabPtr));
|
||||||
adds = xallocarray(i, sizeof(GrabPtr));
|
adds = calloc(i, sizeof(GrabPtr));
|
||||||
updates = xallocarray(i, sizeof(Mask **));
|
updates = calloc(i, sizeof(Mask **));
|
||||||
details = xallocarray(i, sizeof(Mask *));
|
details = calloc(i, sizeof(Mask *));
|
||||||
if (!deletes || !adds || !updates || !details) {
|
if (!deletes || !adds || !updates || !details) {
|
||||||
free(details);
|
free(details);
|
||||||
free(updates);
|
free(updates);
|
||||||
|
|
|
@ -149,8 +149,8 @@ ProcRotateProperties(ClientPtr client)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
atoms = (Atom *) &stuff[1];
|
atoms = (Atom *) &stuff[1];
|
||||||
props = xallocarray(stuff->nAtoms, sizeof(PropertyPtr));
|
props = calloc(stuff->nAtoms, sizeof(PropertyPtr));
|
||||||
saved = xallocarray(stuff->nAtoms, sizeof(PropertyRec));
|
saved = calloc(stuff->nAtoms, sizeof(PropertyRec));
|
||||||
if (!props || !saved) {
|
if (!props || !saved) {
|
||||||
rc = BadAlloc;
|
rc = BadAlloc;
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -331,7 +331,7 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
}
|
}
|
||||||
else if (mode == PropModeAppend) {
|
else if (mode == PropModeAppend) {
|
||||||
data = xallocarray(pProp->size + len, sizeInBytes);
|
data = calloc(pProp->size + len, sizeInBytes);
|
||||||
if (!data)
|
if (!data)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
memcpy(data, pProp->data, pProp->size * sizeInBytes);
|
memcpy(data, pProp->data, pProp->size * sizeInBytes);
|
||||||
|
@ -340,7 +340,7 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
|
||||||
pProp->size += len;
|
pProp->size += len;
|
||||||
}
|
}
|
||||||
else if (mode == PropModePrepend) {
|
else if (mode == PropModePrepend) {
|
||||||
data = xallocarray(len + pProp->size, sizeInBytes);
|
data = calloc(len + pProp->size, sizeInBytes);
|
||||||
if (!data)
|
if (!data)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
memcpy(data + totalSize, pProp->data, pProp->size * sizeInBytes);
|
memcpy(data + totalSize, pProp->data, pProp->size * sizeInBytes);
|
||||||
|
@ -592,7 +592,7 @@ ProcListProperties(ClientPtr client)
|
||||||
numProps++;
|
numProps++;
|
||||||
|
|
||||||
if (numProps) {
|
if (numProps) {
|
||||||
pAtoms = xallocarray(numProps, sizeof(Atom));
|
pAtoms = calloc(numProps, sizeof(Atom));
|
||||||
if (!pAtoms)
|
if (!pAtoms)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
|
|
|
@ -852,10 +852,10 @@ RebuildTable(int client)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
j = 2 * clientTable[client].buckets;
|
j = 2 * clientTable[client].buckets;
|
||||||
tails = xallocarray(j, sizeof(ResourcePtr *));
|
tails = calloc(j, sizeof(ResourcePtr *));
|
||||||
if (!tails)
|
if (!tails)
|
||||||
return;
|
return;
|
||||||
resources = xallocarray(j, sizeof(ResourcePtr));
|
resources = calloc(j, sizeof(ResourcePtr));
|
||||||
if (!resources) {
|
if (!resources) {
|
||||||
free(tails);
|
free(tails);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -371,7 +371,6 @@ exaHWCopyNtoN(DrawablePtr pSrcDrawable,
|
||||||
int src_off_x, src_off_y;
|
int src_off_x, src_off_y;
|
||||||
int dst_off_x, dst_off_y;
|
int dst_off_x, dst_off_y;
|
||||||
RegionPtr srcregion = NULL, dstregion = NULL;
|
RegionPtr srcregion = NULL, dstregion = NULL;
|
||||||
xRectangle *rects;
|
|
||||||
Bool ret = TRUE;
|
Bool ret = TRUE;
|
||||||
|
|
||||||
/* avoid doing copy operations if no boxes */
|
/* avoid doing copy operations if no boxes */
|
||||||
|
@ -384,8 +383,7 @@ exaHWCopyNtoN(DrawablePtr pSrcDrawable,
|
||||||
exaGetDrawableDeltas(pSrcDrawable, pSrcPixmap, &src_off_x, &src_off_y);
|
exaGetDrawableDeltas(pSrcDrawable, pSrcPixmap, &src_off_x, &src_off_y);
|
||||||
exaGetDrawableDeltas(pDstDrawable, pDstPixmap, &dst_off_x, &dst_off_y);
|
exaGetDrawableDeltas(pDstDrawable, pDstPixmap, &dst_off_x, &dst_off_y);
|
||||||
|
|
||||||
rects = xallocarray(nbox, sizeof(xRectangle));
|
xRectangle *rects = calloc(nbox, sizeof(xRectangle));
|
||||||
|
|
||||||
if (rects) {
|
if (rects) {
|
||||||
int i;
|
int i;
|
||||||
int ordering;
|
int ordering;
|
||||||
|
@ -614,7 +612,6 @@ exaPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
|
||||||
{
|
{
|
||||||
ExaScreenPriv(pDrawable->pScreen);
|
ExaScreenPriv(pDrawable->pScreen);
|
||||||
int i;
|
int i;
|
||||||
xRectangle *prect;
|
|
||||||
|
|
||||||
/* If we can't reuse the current GC as is, don't bother accelerating the
|
/* If we can't reuse the current GC as is, don't bother accelerating the
|
||||||
* points.
|
* points.
|
||||||
|
@ -624,7 +621,9 @@ exaPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
prect = xallocarray(npt, sizeof(xRectangle));
|
xRectangle *prect = calloc(npt, sizeof(xRectangle));
|
||||||
|
if (!prect)
|
||||||
|
return;
|
||||||
for (i = 0; i < npt; i++) {
|
for (i = 0; i < npt; i++) {
|
||||||
prect[i].x = ppt[i].x;
|
prect[i].x = ppt[i].x;
|
||||||
prect[i].y = ppt[i].y;
|
prect[i].y = ppt[i].y;
|
||||||
|
@ -649,7 +648,6 @@ exaPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
|
||||||
DDXPointPtr ppt)
|
DDXPointPtr ppt)
|
||||||
{
|
{
|
||||||
ExaScreenPriv(pDrawable->pScreen);
|
ExaScreenPriv(pDrawable->pScreen);
|
||||||
xRectangle *prect;
|
|
||||||
int x1, x2, y1, y2;
|
int x1, x2, y1, y2;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -665,7 +663,9 @@ exaPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
prect = xallocarray(npt - 1, sizeof(xRectangle));
|
xRectangle *prect = calloc(npt - 1, sizeof(xRectangle));
|
||||||
|
if (!prect)
|
||||||
|
return;
|
||||||
x1 = ppt[0].x;
|
x1 = ppt[0].x;
|
||||||
y1 = ppt[0].y;
|
y1 = ppt[0].y;
|
||||||
/* If we have any non-horizontal/vertical, fall back. */
|
/* If we have any non-horizontal/vertical, fall back. */
|
||||||
|
@ -718,7 +718,6 @@ static void
|
||||||
exaPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSeg)
|
exaPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSeg)
|
||||||
{
|
{
|
||||||
ExaScreenPriv(pDrawable->pScreen);
|
ExaScreenPriv(pDrawable->pScreen);
|
||||||
xRectangle *prect;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Don't try to do wide lines or non-solid fill style. */
|
/* Don't try to do wide lines or non-solid fill style. */
|
||||||
|
@ -736,7 +735,9 @@ exaPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSeg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
prect = xallocarray((unsigned int)nseg, sizeof(xRectangle));
|
xRectangle *prect = calloc((unsigned int)nseg, sizeof(xRectangle));
|
||||||
|
if (!prect)
|
||||||
|
return;
|
||||||
for (i = 0; i < nseg; i++) {
|
for (i = 0; i < nseg; i++) {
|
||||||
if (pSeg[i].x1 < pSeg[i].x2) {
|
if (pSeg[i].x1 < pSeg[i].x2) {
|
||||||
prect[i].x = pSeg[i].x1;
|
prect[i].x = pSeg[i].x1;
|
||||||
|
|
|
@ -209,8 +209,8 @@ exaRealizeGlyphCaches(ScreenPtr pScreen, unsigned int format)
|
||||||
|
|
||||||
cache->picture = pPicture;
|
cache->picture = pPicture;
|
||||||
cache->picture->refcnt++;
|
cache->picture->refcnt++;
|
||||||
cache->hashEntries = xallocarray(cache->hashSize, sizeof(int));
|
cache->hashEntries = calloc(cache->hashSize, sizeof(int));
|
||||||
cache->glyphs = xallocarray(cache->size, sizeof(ExaCachedGlyphRec));
|
cache->glyphs = calloc(cache->size, sizeof(ExaCachedGlyphRec));
|
||||||
cache->glyphCount = 0;
|
cache->glyphCount = 0;
|
||||||
|
|
||||||
if (!cache->hashEntries || !cache->glyphs)
|
if (!cache->hashEntries || !cache->glyphs)
|
||||||
|
|
|
@ -203,8 +203,8 @@ exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg)
|
||||||
|
|
||||||
/* Do we need to allocate our system buffer? */
|
/* Do we need to allocate our system buffer? */
|
||||||
if (!pExaPixmap->sys_ptr) {
|
if (!pExaPixmap->sys_ptr) {
|
||||||
pExaPixmap->sys_ptr = xallocarray(pExaPixmap->sys_pitch,
|
pExaPixmap->sys_ptr = calloc(pExaPixmap->sys_pitch,
|
||||||
pPixmap->drawable.height);
|
pPixmap->drawable.height);
|
||||||
if (!pExaPixmap->sys_ptr)
|
if (!pExaPixmap->sys_ptr)
|
||||||
FatalError("EXA: malloc failed for size %d bytes\n",
|
FatalError("EXA: malloc failed for size %d bytes\n",
|
||||||
pExaPixmap->sys_pitch * pPixmap->drawable.height);
|
pExaPixmap->sys_pitch * pPixmap->drawable.height);
|
||||||
|
|
|
@ -192,7 +192,7 @@ fbCopyNto1(DrawablePtr pSrcDrawable,
|
||||||
height = pbox->y2 - pbox->y1;
|
height = pbox->y2 - pbox->y1;
|
||||||
|
|
||||||
tmpStride = ((width + FB_STIP_MASK) >> FB_STIP_SHIFT);
|
tmpStride = ((width + FB_STIP_MASK) >> FB_STIP_SHIFT);
|
||||||
tmp = xallocarray(tmpStride * height, sizeof(FbStip));
|
tmp = calloc(tmpStride * height, sizeof(FbStip));
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ fbGlyphs(CARD8 op,
|
||||||
pixman_glyph_cache_freeze (glyphCache);
|
pixman_glyph_cache_freeze (glyphCache);
|
||||||
|
|
||||||
if (n_glyphs > N_STACK_GLYPHS) {
|
if (n_glyphs > N_STACK_GLYPHS) {
|
||||||
if (!(pglyphs = xallocarray(n_glyphs, sizeof(pixman_glyph_t))))
|
if (!(pglyphs = calloc(n_glyphs, sizeof(pixman_glyph_t))))
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ _pixman_region_init_clipped_rectangles(pixman_region16_t * region,
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
|
|
||||||
if (num_rects > ARRAY_SIZE(stack_boxes)) {
|
if (num_rects > ARRAY_SIZE(stack_boxes)) {
|
||||||
boxes = xallocarray(num_rects, sizeof(pixman_box16_t));
|
boxes = calloc(num_rects, sizeof(pixman_box16_t));
|
||||||
if (boxes == NULL)
|
if (boxes == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -989,13 +989,13 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen,
|
||||||
|
|
||||||
/* Set all the stops and colors to shader. */
|
/* Set all the stops and colors to shader. */
|
||||||
if (stops_count > RADIAL_SMALL_STOPS) {
|
if (stops_count > RADIAL_SMALL_STOPS) {
|
||||||
stop_colors = xallocarray(stops_count, 4 * sizeof(float));
|
stop_colors = calloc(stops_count, 4 * sizeof(float));
|
||||||
if (stop_colors == NULL) {
|
if (stop_colors == NULL) {
|
||||||
ErrorF("Failed to allocate stop_colors memory.\n");
|
ErrorF("Failed to allocate stop_colors memory.\n");
|
||||||
goto GRADIENT_FAIL;
|
goto GRADIENT_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
n_stops = xallocarray(stops_count, sizeof(float));
|
n_stops = calloc(stops_count, sizeof(float));
|
||||||
if (n_stops == NULL) {
|
if (n_stops == NULL) {
|
||||||
ErrorF("Failed to allocate n_stops memory.\n");
|
ErrorF("Failed to allocate n_stops memory.\n");
|
||||||
goto GRADIENT_FAIL;
|
goto GRADIENT_FAIL;
|
||||||
|
@ -1327,13 +1327,13 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen,
|
||||||
|
|
||||||
/* Set all the stops and colors to shader. */
|
/* Set all the stops and colors to shader. */
|
||||||
if (stops_count > LINEAR_SMALL_STOPS) {
|
if (stops_count > LINEAR_SMALL_STOPS) {
|
||||||
stop_colors = xallocarray(stops_count, 4 * sizeof(float));
|
stop_colors = calloc(stops_count, 4 * sizeof(float));
|
||||||
if (stop_colors == NULL) {
|
if (stop_colors == NULL) {
|
||||||
ErrorF("Failed to allocate stop_colors memory.\n");
|
ErrorF("Failed to allocate stop_colors memory.\n");
|
||||||
goto GRADIENT_FAIL;
|
goto GRADIENT_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
n_stops = xallocarray(stops_count, sizeof(float));
|
n_stops = calloc(stops_count, sizeof(float));
|
||||||
if (n_stops == NULL) {
|
if (n_stops == NULL) {
|
||||||
ErrorF("Failed to allocate n_stops memory.\n");
|
ErrorF("Failed to allocate n_stops memory.\n");
|
||||||
goto GRADIENT_FAIL;
|
goto GRADIENT_FAIL;
|
||||||
|
|
|
@ -118,8 +118,8 @@ glamor_prep_drawable_box(DrawablePtr drawable, glamor_access_t access, BoxPtr bo
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!priv->pbo) {
|
if (!priv->pbo) {
|
||||||
pixmap->devPrivate.ptr = xallocarray(pixmap->devKind,
|
pixmap->devPrivate.ptr = calloc(pixmap->devKind,
|
||||||
pixmap->drawable.height);
|
pixmap->drawable.height);
|
||||||
if (!pixmap->devPrivate.ptr)
|
if (!pixmap->devPrivate.ptr)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ glamor_solid_boxes(DrawablePtr drawable,
|
||||||
xRectangle *rect;
|
xRectangle *rect;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
rect = xallocarray(nbox, sizeof(xRectangle));
|
rect = calloc(nbox, sizeof(xRectangle));
|
||||||
if (!rect)
|
if (!rect)
|
||||||
return;
|
return;
|
||||||
for (n = 0; n < nbox; n++) {
|
for (n = 0; n < nbox; n++) {
|
||||||
|
|
|
@ -931,7 +931,7 @@ hostx_screen_init(KdScreenInfo *screen,
|
||||||
scrpriv->ximg->byte_order = IMAGE_BYTE_ORDER;
|
scrpriv->ximg->byte_order = IMAGE_BYTE_ORDER;
|
||||||
|
|
||||||
scrpriv->ximg->data =
|
scrpriv->ximg->data =
|
||||||
xallocarray(scrpriv->ximg->stride, buffer_height);
|
calloc(scrpriv->ximg->stride, buffer_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!HostX.size_set_from_configure)
|
if (!HostX.size_set_from_configure)
|
||||||
|
@ -1000,7 +1000,7 @@ hostx_screen_init(KdScreenInfo *screen,
|
||||||
*bits_per_pixel = scrpriv->server_depth;
|
*bits_per_pixel = scrpriv->server_depth;
|
||||||
|
|
||||||
EPHYR_DBG("server bpp %i", bytes_per_pixel);
|
EPHYR_DBG("server bpp %i", bytes_per_pixel);
|
||||||
scrpriv->fb_data = xallocarray (stride, buffer_height);
|
scrpriv->fb_data = calloc(stride, buffer_height);
|
||||||
return scrpriv->fb_data;
|
return scrpriv->fb_data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ KdShadowFbAlloc(KdScreenInfo * screen, Bool rotate)
|
||||||
|
|
||||||
/* use fb computation for width */
|
/* use fb computation for width */
|
||||||
paddedWidth = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits);
|
paddedWidth = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits);
|
||||||
buf = xallocarray(paddedWidth, height);
|
buf = calloc(paddedWidth, height);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (screen->fb.shadow)
|
if (screen->fb.shadow)
|
||||||
|
|
|
@ -483,9 +483,11 @@ vfbInstallColormap(ColormapPtr pmap)
|
||||||
swapcopy32(pXWDHeader->bits_per_rgb, pVisual->bitsPerRGBValue);
|
swapcopy32(pXWDHeader->bits_per_rgb, pVisual->bitsPerRGBValue);
|
||||||
swapcopy32(pXWDHeader->colormap_entries, pVisual->ColormapEntries);
|
swapcopy32(pXWDHeader->colormap_entries, pVisual->ColormapEntries);
|
||||||
|
|
||||||
ppix = xallocarray(entries, sizeof(Pixel));
|
ppix = calloc(entries, sizeof(Pixel));
|
||||||
prgb = xallocarray(entries, sizeof(xrgb));
|
prgb = calloc(entries, sizeof(xrgb));
|
||||||
defs = xallocarray(entries, sizeof(xColorItem));
|
defs = calloc(entries, sizeof(xColorItem));
|
||||||
|
if (!ppix || !prgb || !defs)
|
||||||
|
goto out;
|
||||||
|
|
||||||
for (i = 0; i < entries; i++)
|
for (i = 0; i < entries; i++)
|
||||||
ppix[i] = i;
|
ppix[i] = i;
|
||||||
|
@ -501,6 +503,7 @@ vfbInstallColormap(ColormapPtr pmap)
|
||||||
}
|
}
|
||||||
(*pmap->pScreen->StoreColors) (pmap, entries, defs);
|
(*pmap->pScreen->StoreColors) (pmap, entries, defs);
|
||||||
|
|
||||||
|
out:
|
||||||
free(ppix);
|
free(ppix);
|
||||||
free(prgb);
|
free(prgb);
|
||||||
free(defs);
|
free(defs);
|
||||||
|
|
|
@ -1322,7 +1322,7 @@ ProcXDGAQueryModes(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(mode = xallocarray(num, sizeof(XDGAModeRec))))
|
if (!(mode = calloc(num, sizeof(XDGAModeRec))))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
for (i = 0; i < num; i++)
|
for (i = 0; i < num; i++)
|
||||||
|
|
|
@ -160,10 +160,10 @@ xf86HandleColormaps(ScreenPtr pScreen,
|
||||||
|
|
||||||
elements = 1 << sigRGBbits;
|
elements = 1 << sigRGBbits;
|
||||||
|
|
||||||
if (!(gamma = xallocarray(elements, sizeof(LOCO))))
|
if (!(gamma = calloc(elements, sizeof(LOCO))))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!(indices = xallocarray(maxColors, sizeof(int)))) {
|
if (!(indices = calloc(maxColors, sizeof(int)))) {
|
||||||
free(gamma);
|
free(gamma);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -273,7 +273,7 @@ CMapAllocateColormapPrivate(ColormapPtr pmap)
|
||||||
else
|
else
|
||||||
numColors = 1 << pmap->pVisual->nplanes;
|
numColors = 1 << pmap->pVisual->nplanes;
|
||||||
|
|
||||||
if (!(colors = xallocarray(numColors, sizeof(LOCO))))
|
if (!(colors = calloc(numColors, sizeof(LOCO))))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!(pColPriv = malloc(sizeof(CMapColormapRec)))) {
|
if (!(pColPriv = malloc(sizeof(CMapColormapRec)))) {
|
||||||
|
|
|
@ -648,7 +648,7 @@ xf86SbusCmapLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
|
||||||
return;
|
return;
|
||||||
fbcmap.count = 0;
|
fbcmap.count = 0;
|
||||||
fbcmap.index = indices[0];
|
fbcmap.index = indices[0];
|
||||||
fbcmap.red = data = xallocarray(numColors, 3);
|
fbcmap.red = data = calloc(numColors, 3);
|
||||||
if (!data)
|
if (!data)
|
||||||
return;
|
return;
|
||||||
fbcmap.green = data + numColors;
|
fbcmap.green = data + numColors;
|
||||||
|
|
|
@ -155,7 +155,7 @@ xf86XvMCScreenInit(ScreenPtr pScreen,
|
||||||
if (noXvExtension)
|
if (noXvExtension)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!(pAdapt = xallocarray(num_adaptors, sizeof(XvMCAdaptorRec))))
|
if (!(pAdapt = calloc(num_adaptors, sizeof(XvMCAdaptorRec))))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!dixRegisterPrivateKey(&XF86XvMCScreenKeyRec, PRIVATE_SCREEN, 0)) {
|
if (!dixRegisterPrivateKey(&XF86XvMCScreenKeyRec, PRIVATE_SCREEN, 0)) {
|
||||||
|
|
|
@ -423,7 +423,7 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
|
||||||
|
|
||||||
if (rep.numClipRects) {
|
if (rep.numClipRects) {
|
||||||
/* Clip cliprects to screen dimensions (redirected windows) */
|
/* Clip cliprects to screen dimensions (redirected windows) */
|
||||||
pClippedRects = xallocarray(rep.numClipRects, sizeof(drm_clip_rect_t));
|
pClippedRects = calloc(rep.numClipRects, sizeof(drm_clip_rect_t));
|
||||||
|
|
||||||
if (!pClippedRects)
|
if (!pClippedRects)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
|
@ -1608,7 +1608,7 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
|
||||||
if (info->version == 3 || info->numDrivers == 0) {
|
if (info->version == 3 || info->numDrivers == 0) {
|
||||||
/* Driver too old: use the old-style driverName field */
|
/* Driver too old: use the old-style driverName field */
|
||||||
ds->numDrivers = info->driverName ? 1 : 2;
|
ds->numDrivers = info->driverName ? 1 : 2;
|
||||||
ds->driverNames = xallocarray(ds->numDrivers, sizeof(*ds->driverNames));
|
ds->driverNames = calloc(ds->numDrivers, sizeof(*ds->driverNames));
|
||||||
if (!ds->driverNames)
|
if (!ds->driverNames)
|
||||||
goto err_out;
|
goto err_out;
|
||||||
|
|
||||||
|
@ -1629,7 +1629,7 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ds->numDrivers = info->numDrivers;
|
ds->numDrivers = info->numDrivers;
|
||||||
ds->driverNames = xallocarray(info->numDrivers, sizeof(*ds->driverNames));
|
ds->driverNames = calloc(info->numDrivers, sizeof(*ds->driverNames));
|
||||||
if (!ds->driverNames)
|
if (!ds->driverNames)
|
||||||
goto err_out;
|
goto err_out;
|
||||||
memcpy(ds->driverNames, info->driverNames,
|
memcpy(ds->driverNames, info->driverNames,
|
||||||
|
|
|
@ -588,7 +588,7 @@ dispatch_damages(ScrnInfoPtr scrn, xf86CrtcPtr crtc, RegionPtr dirty,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (num_cliprects) {
|
if (num_cliprects) {
|
||||||
drmModeClip *clip = xallocarray(num_cliprects, sizeof(drmModeClip));
|
drmModeClip *clip = calloc(num_cliprects, sizeof(drmModeClip));
|
||||||
BoxPtr rect = REGION_RECTS(dirty);
|
BoxPtr rect = REGION_RECTS(dirty);
|
||||||
int i;
|
int i;
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
|
@ -3799,7 +3799,7 @@ drmmode_create_lease(RRLeasePtr lease, int *fd)
|
||||||
if (!lease_private)
|
if (!lease_private)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
objects = xallocarray(nobjects, sizeof (uint32_t));
|
objects = calloc(nobjects, sizeof(uint32_t));
|
||||||
|
|
||||||
if (!objects) {
|
if (!objects) {
|
||||||
free(lease_private);
|
free(lease_private);
|
||||||
|
|
|
@ -375,6 +375,8 @@ VBEGetVBEInfo(vbeInfoPtr pVbe)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
block = calloc(1, sizeof(VbeInfoBlock));
|
block = calloc(1, sizeof(VbeInfoBlock));
|
||||||
|
if (!block)
|
||||||
|
return NULL;
|
||||||
block->VESASignature[0] = ((char *) pVbe->memory)[0];
|
block->VESASignature[0] = ((char *) pVbe->memory)[0];
|
||||||
block->VESASignature[1] = ((char *) pVbe->memory)[1];
|
block->VESASignature[1] = ((char *) pVbe->memory)[1];
|
||||||
block->VESASignature[2] = ((char *) pVbe->memory)[2];
|
block->VESASignature[2] = ((char *) pVbe->memory)[2];
|
||||||
|
@ -397,7 +399,11 @@ VBEGetVBEInfo(vbeInfoPtr pVbe)
|
||||||
i = 0;
|
i = 0;
|
||||||
while (modes[i] != 0xffff)
|
while (modes[i] != 0xffff)
|
||||||
i++;
|
i++;
|
||||||
block->VideoModePtr = xallocarray(i + 1, sizeof(CARD16));
|
block->VideoModePtr = calloc(i + 1, sizeof(CARD16));
|
||||||
|
if (!(block->VideoModePtr)) {
|
||||||
|
free(block);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
memcpy(block->VideoModePtr, modes, sizeof(CARD16) * i);
|
memcpy(block->VideoModePtr, modes, sizeof(CARD16) * i);
|
||||||
block->VideoModePtr[i] = 0xffff;
|
block->VideoModePtr[i] = 0xffff;
|
||||||
|
|
||||||
|
@ -825,7 +831,9 @@ VBESetGetPaletteData(vbeInfoPtr pVbe, Bool set, int first, int num,
|
||||||
if (set)
|
if (set)
|
||||||
return data;
|
return data;
|
||||||
|
|
||||||
data = xallocarray(num, sizeof(CARD32));
|
data = calloc(num, sizeof(CARD32));
|
||||||
|
if (!data)
|
||||||
|
return NULL;
|
||||||
memcpy(data, pVbe->memory, num * sizeof(CARD32));
|
memcpy(data, pVbe->memory, num * sizeof(CARD32));
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
|
|
@ -228,7 +228,7 @@ InitPatterns(const char **patternlist)
|
||||||
for (i = 0, s = patternlist; *s; i++, s++)
|
for (i = 0, s = patternlist; *s; i++, s++)
|
||||||
if (*s == DEFAULT_LIST)
|
if (*s == DEFAULT_LIST)
|
||||||
i += ARRAY_SIZE(stdPatterns) - 1 - 1;
|
i += ARRAY_SIZE(stdPatterns) - 1 - 1;
|
||||||
patterns = xallocarray(i + 1, sizeof(PatternRec));
|
patterns = calloc(i + 1, sizeof(PatternRec));
|
||||||
if (!patterns) {
|
if (!patterns) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ xf86CrtcCreate(ScrnInfoPtr scrn, const xf86CrtcFuncsRec * funcs)
|
||||||
|
|
||||||
/* Preallocate gamma at a sensible size. */
|
/* Preallocate gamma at a sensible size. */
|
||||||
crtc->gamma_size = 256;
|
crtc->gamma_size = 256;
|
||||||
crtc->gamma_red = xallocarray(crtc->gamma_size, 3 * sizeof(CARD16));
|
crtc->gamma_red = calloc(crtc->gamma_size, 3 * sizeof(CARD16));
|
||||||
if (!crtc->gamma_red) {
|
if (!crtc->gamma_red) {
|
||||||
free(crtc);
|
free(crtc);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -126,7 +126,7 @@ xf86CrtcCreate(ScrnInfoPtr scrn, const xf86CrtcFuncsRec * funcs)
|
||||||
crtcs = reallocarray(xf86_config->crtc,
|
crtcs = reallocarray(xf86_config->crtc,
|
||||||
xf86_config->num_crtc + 1, sizeof(xf86CrtcPtr));
|
xf86_config->num_crtc + 1, sizeof(xf86CrtcPtr));
|
||||||
else
|
else
|
||||||
crtcs = xallocarray(xf86_config->num_crtc + 1, sizeof(xf86CrtcPtr));
|
crtcs = calloc(xf86_config->num_crtc + 1, sizeof(xf86CrtcPtr));
|
||||||
if (!crtcs) {
|
if (!crtcs) {
|
||||||
free(crtc->gamma_red);
|
free(crtc->gamma_red);
|
||||||
free(crtc);
|
free(crtc);
|
||||||
|
@ -670,8 +670,7 @@ xf86OutputCreate(ScrnInfoPtr scrn,
|
||||||
xf86_config->num_output + 1,
|
xf86_config->num_output + 1,
|
||||||
sizeof(xf86OutputPtr));
|
sizeof(xf86OutputPtr));
|
||||||
else
|
else
|
||||||
outputs = xallocarray(xf86_config->num_output + 1,
|
outputs = calloc(xf86_config->num_output + 1, sizeof(xf86OutputPtr));
|
||||||
sizeof(xf86OutputPtr));
|
|
||||||
if (!outputs) {
|
if (!outputs) {
|
||||||
free(output);
|
free(output);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -992,7 +991,7 @@ xf86PickCrtcs(ScrnInfoPtr scrn,
|
||||||
if (modes[n] == NULL)
|
if (modes[n] == NULL)
|
||||||
return best_score;
|
return best_score;
|
||||||
|
|
||||||
crtcs = xallocarray(config->num_output, sizeof(xf86CrtcPtr));
|
crtcs = calloc(config->num_output, sizeof(xf86CrtcPtr));
|
||||||
if (!crtcs)
|
if (!crtcs)
|
||||||
return best_score;
|
return best_score;
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ xf86_dga_get_modes(ScreenPtr pScreen)
|
||||||
if (!num)
|
if (!num)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
modes = xallocarray(num, sizeof(DGAModeRec));
|
modes = calloc(num, sizeof(DGAModeRec));
|
||||||
if (!modes)
|
if (!modes)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
|
@ -1061,7 +1061,7 @@ xf86RandR12CrtcNotify(RRCrtcPtr randr_crtc)
|
||||||
DisplayModePtr mode = &crtc->mode;
|
DisplayModePtr mode = &crtc->mode;
|
||||||
Bool ret;
|
Bool ret;
|
||||||
|
|
||||||
randr_outputs = xallocarray(config->num_output, sizeof(RROutputPtr));
|
randr_outputs = calloc(config->num_output, sizeof(RROutputPtr));
|
||||||
if (!randr_outputs)
|
if (!randr_outputs)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
x = crtc->x;
|
x = crtc->x;
|
||||||
|
@ -1153,7 +1153,9 @@ xf86RandR12CrtcSet(ScreenPtr pScreen,
|
||||||
if (!crtc->scrn->vtSema)
|
if (!crtc->scrn->vtSema)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
save_crtcs = xallocarray(config->num_output, sizeof(xf86CrtcPtr));
|
save_crtcs = calloc(config->num_output, sizeof(xf86CrtcPtr));
|
||||||
|
if (!save_crtcs)
|
||||||
|
return FALSE;
|
||||||
if ((randr_mode != NULL) != crtc->enabled)
|
if ((randr_mode != NULL) != crtc->enabled)
|
||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
else if (randr_mode && !xf86RandRModeMatches(randr_mode, &crtc->mode))
|
else if (randr_mode && !xf86RandRModeMatches(randr_mode, &crtc->mode))
|
||||||
|
@ -1429,7 +1431,7 @@ xf86RandR12CrtcInitGamma(xf86CrtcPtr crtc, float gamma_red, float gamma_green,
|
||||||
(gamma_red != 1.0f || gamma_green != 1.0f || gamma_blue != 1.0f))
|
(gamma_red != 1.0f || gamma_green != 1.0f || gamma_blue != 1.0f))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
red = xallocarray(size, 3 * sizeof(CARD16));
|
red = calloc(size, 3 * sizeof(CARD16));
|
||||||
if (!red)
|
if (!red)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -1596,7 +1598,7 @@ xf86RROutputSetModes(RROutputPtr randr_output, DisplayModePtr modes)
|
||||||
nmode++;
|
nmode++;
|
||||||
|
|
||||||
if (nmode) {
|
if (nmode) {
|
||||||
rrmodes = xallocarray(nmode, sizeof(RRModePtr));
|
rrmodes = calloc(nmode, sizeof(RRModePtr));
|
||||||
|
|
||||||
if (!rrmodes)
|
if (!rrmodes)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1651,8 +1653,13 @@ xf86RandR12SetInfo12(ScreenPtr pScreen)
|
||||||
int o, c, l;
|
int o, c, l;
|
||||||
int nclone;
|
int nclone;
|
||||||
|
|
||||||
clones = xallocarray(config->num_output, sizeof(RROutputPtr));
|
clones = calloc(config->num_output, sizeof(RROutputPtr));
|
||||||
crtcs = xallocarray(config->num_crtc, sizeof(RRCrtcPtr));
|
crtcs = calloc(config->num_crtc, sizeof(RRCrtcPtr));
|
||||||
|
if (!clones || !crtcs) {
|
||||||
|
free(clones);
|
||||||
|
free(crtcs);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
for (o = 0; o < config->num_output; o++) {
|
for (o = 0; o < config->num_output; o++) {
|
||||||
xf86OutputPtr output = config->output[o];
|
xf86OutputPtr output = config->output[o];
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,9 @@ xnestCreateColormap(ColormapPtr pCmap)
|
||||||
|
|
||||||
switch (pVisual->class) {
|
switch (pVisual->class) {
|
||||||
case StaticGray: /* read only */
|
case StaticGray: /* read only */
|
||||||
colors = xallocarray(ncolors, sizeof(XColor));
|
colors = calloc(ncolors, sizeof(XColor));
|
||||||
|
if (!colors)
|
||||||
|
return FALSE;
|
||||||
for (i = 0; i < ncolors; i++)
|
for (i = 0; i < ncolors; i++)
|
||||||
colors[i].pixel = i;
|
colors[i].pixel = i;
|
||||||
XQueryColors(xnestDisplay, xnestColormap(pCmap), colors, ncolors);
|
XQueryColors(xnestDisplay, xnestColormap(pCmap), colors, ncolors);
|
||||||
|
@ -76,7 +78,9 @@ xnestCreateColormap(ColormapPtr pCmap)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case StaticColor: /* read only */
|
case StaticColor: /* read only */
|
||||||
colors = xallocarray(ncolors, sizeof(XColor));
|
colors = calloc(ncolors, sizeof(XColor));
|
||||||
|
if (!colors)
|
||||||
|
return FALSE;
|
||||||
for (i = 0; i < ncolors; i++)
|
for (i = 0; i < ncolors; i++)
|
||||||
colors[i].pixel = i;
|
colors[i].pixel = i;
|
||||||
XQueryColors(xnestDisplay, xnestColormap(pCmap), colors, ncolors);
|
XQueryColors(xnestDisplay, xnestColormap(pCmap), colors, ncolors);
|
||||||
|
@ -89,7 +93,9 @@ xnestCreateColormap(ColormapPtr pCmap)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TrueColor: /* read only */
|
case TrueColor: /* read only */
|
||||||
colors = xallocarray(ncolors, sizeof(XColor));
|
colors = calloc(ncolors, sizeof(XColor));
|
||||||
|
if (!colors)
|
||||||
|
return FALSE;
|
||||||
red = green = blue = 0L;
|
red = green = blue = 0L;
|
||||||
redInc = lowbit(pVisual->redMask);
|
redInc = lowbit(pVisual->redMask);
|
||||||
greenInc = lowbit(pVisual->greenMask);
|
greenInc = lowbit(pVisual->greenMask);
|
||||||
|
@ -195,12 +201,18 @@ xnestSetInstalledColormapWindows(ScreenPtr pScreen)
|
||||||
xnestInstalledColormapWindows icws;
|
xnestInstalledColormapWindows icws;
|
||||||
int numWindows;
|
int numWindows;
|
||||||
|
|
||||||
icws.cmapIDs = xallocarray(pScreen->maxInstalledCmaps, sizeof(Colormap));
|
icws.cmapIDs = calloc(pScreen->maxInstalledCmaps, sizeof(Colormap));
|
||||||
|
if (!icws.cmapIDs)
|
||||||
|
return;
|
||||||
icws.numCmapIDs = xnestListInstalledColormaps(pScreen, icws.cmapIDs);
|
icws.numCmapIDs = xnestListInstalledColormaps(pScreen, icws.cmapIDs);
|
||||||
icws.numWindows = 0;
|
icws.numWindows = 0;
|
||||||
WalkTree(pScreen, xnestCountInstalledColormapWindows, (void *) &icws);
|
WalkTree(pScreen, xnestCountInstalledColormapWindows, (void *) &icws);
|
||||||
if (icws.numWindows) {
|
if (icws.numWindows) {
|
||||||
icws.windows = xallocarray(icws.numWindows + 1, sizeof(Window));
|
icws.windows = calloc(icws.numWindows + 1, sizeof(Window));
|
||||||
|
if (!icws.windows) {
|
||||||
|
free(icws.cmapIDs);
|
||||||
|
return;
|
||||||
|
}
|
||||||
icws.index = 0;
|
icws.index = 0;
|
||||||
WalkTree(pScreen, xnestGetInstalledColormapWindows, (void *) &icws);
|
WalkTree(pScreen, xnestGetInstalledColormapWindows, (void *) &icws);
|
||||||
icws.windows[icws.numWindows] = xnestDefaultWindows[pScreen->myNum];
|
icws.windows[icws.numWindows] = xnestDefaultWindows[pScreen->myNum];
|
||||||
|
@ -219,7 +231,9 @@ xnestSetInstalledColormapWindows(ScreenPtr pScreen)
|
||||||
#ifdef _XSERVER64
|
#ifdef _XSERVER64
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
Window64 *windows = xallocarray(numWindows, sizeof(Window64));
|
Window64 *windows = calloc(numWindows, sizeof(Window64));
|
||||||
|
if (!windows)
|
||||||
|
return;
|
||||||
|
|
||||||
for (i = 0; i < numWindows; ++i)
|
for (i = 0; i < numWindows; ++i)
|
||||||
windows[i] = icws.windows[i];
|
windows[i] = icws.windows[i];
|
||||||
|
@ -391,7 +405,9 @@ xnestStoreColors(ColormapPtr pCmap, int nColors, xColorItem * pColors)
|
||||||
#ifdef _XSERVER64
|
#ifdef _XSERVER64
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
XColor *pColors64 = xallocarray(nColors, sizeof(XColor));
|
XColor *pColors64 = calloc(nColors, sizeof(XColor));
|
||||||
|
if (!pColors64)
|
||||||
|
return;
|
||||||
|
|
||||||
for (i = 0; i < nColors; ++i) {
|
for (i = 0; i < nColors; ++i) {
|
||||||
pColors64[i].pixel = pColors[i].pixel;
|
pColors64[i].pixel = pColors[i].pixel;
|
||||||
|
|
|
@ -117,8 +117,9 @@ xnestOpenDisplay(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
xnestNumDefaultColormaps = xnestNumVisuals;
|
xnestNumDefaultColormaps = xnestNumVisuals;
|
||||||
xnestDefaultColormaps = xallocarray(xnestNumDefaultColormaps,
|
xnestDefaultColormaps = calloc(xnestNumDefaultColormaps, sizeof(Colormap));
|
||||||
sizeof(Colormap));
|
if (!xnestDefaultColormaps)
|
||||||
|
return;
|
||||||
for (i = 0; i < xnestNumDefaultColormaps; i++)
|
for (i = 0; i < xnestNumDefaultColormaps; i++)
|
||||||
xnestDefaultColormaps[i] = XCreateColormap(xnestDisplay,
|
xnestDefaultColormaps[i] = XCreateColormap(xnestDisplay,
|
||||||
DefaultRootWindow
|
DefaultRootWindow
|
||||||
|
|
|
@ -203,7 +203,9 @@ xnestChangeClip(GCPtr pGC, int type, void *pValue, int nRects)
|
||||||
|
|
||||||
case CT_REGION:
|
case CT_REGION:
|
||||||
nRects = RegionNumRects((RegionPtr) pValue);
|
nRects = RegionNumRects((RegionPtr) pValue);
|
||||||
pRects = xallocarray(nRects, sizeof(*pRects));
|
pRects = calloc(nRects, sizeof(*pRects));
|
||||||
|
if (!pRects)
|
||||||
|
break;
|
||||||
pBox = RegionRects((RegionPtr) pValue);
|
pBox = RegionRects((RegionPtr) pValue);
|
||||||
for (i = nRects; i-- > 0;) {
|
for (i = nRects; i-- > 0;) {
|
||||||
pRects[i].x = pBox[i].x1;
|
pRects[i].x = pBox[i].x1;
|
||||||
|
|
|
@ -119,7 +119,8 @@ xnestKeyboardProc(DeviceIntPtr pDev, int onoff)
|
||||||
max_keycode - min_keycode + 1,
|
max_keycode - min_keycode + 1,
|
||||||
&mapWidth);
|
&mapWidth);
|
||||||
len = (max_keycode - min_keycode + 1) * mapWidth;
|
len = (max_keycode - min_keycode + 1) * mapWidth;
|
||||||
keymap = xallocarray(len, sizeof(KeySym));
|
if (!(keymap = calloc(len, sizeof(KeySym))))
|
||||||
|
goto XkbError;
|
||||||
for (i = 0; i < len; ++i)
|
for (i = 0; i < len; ++i)
|
||||||
keymap[i] = keymap64[i];
|
keymap[i] = keymap64[i];
|
||||||
XFree(keymap64);
|
XFree(keymap64);
|
||||||
|
|
|
@ -164,7 +164,9 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
|
||||||
PRIVATE_CURSOR, 0))
|
PRIVATE_CURSOR, 0))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
visuals = xallocarray(xnestNumVisuals, sizeof(VisualRec));
|
visuals = calloc(xnestNumVisuals, sizeof(VisualRec));
|
||||||
|
if (!visuals)
|
||||||
|
return FALSE;
|
||||||
numVisuals = 0;
|
numVisuals = 0;
|
||||||
|
|
||||||
depths = (DepthPtr) malloc(MAXDEPTH * sizeof(DepthRec));
|
depths = (DepthPtr) malloc(MAXDEPTH * sizeof(DepthRec));
|
||||||
|
|
|
@ -125,7 +125,6 @@ xwl_randr_request_lease(ClientPtr client, ScreenPtr screen, RRLeasePtr rrLease)
|
||||||
{
|
{
|
||||||
struct xwl_screen *xwl_screen;
|
struct xwl_screen *xwl_screen;
|
||||||
struct wp_drm_lease_request_v1 *req;
|
struct wp_drm_lease_request_v1 *req;
|
||||||
struct xwl_drm_lease *lease_private;
|
|
||||||
struct xwl_drm_lease_device *lease_device = NULL;
|
struct xwl_drm_lease_device *lease_device = NULL;
|
||||||
struct xwl_drm_lease_device *device_data;
|
struct xwl_drm_lease_device *device_data;
|
||||||
struct xwl_output *output;
|
struct xwl_output *output;
|
||||||
|
@ -165,7 +164,9 @@ xwl_randr_request_lease(ClientPtr client, ScreenPtr screen, RRLeasePtr rrLease)
|
||||||
|
|
||||||
req = wp_drm_lease_device_v1_create_lease_request(
|
req = wp_drm_lease_device_v1_create_lease_request(
|
||||||
lease_device->drm_lease_device);
|
lease_device->drm_lease_device);
|
||||||
lease_private = calloc(1, sizeof(struct xwl_drm_lease));
|
struct xwl_drm_lease *lease_private = calloc(1, sizeof(struct xwl_drm_lease));
|
||||||
|
if (!lease_private)
|
||||||
|
return BadAlloc;
|
||||||
for (i = 0; i < rrLease->numOutputs; ++i) {
|
for (i = 0; i < rrLease->numOutputs; ++i) {
|
||||||
output = rrLease->outputs[i]->devPrivate;
|
output = rrLease->outputs[i]->devPrivate;
|
||||||
output->lease = lease_private;
|
output->lease = lease_private;
|
||||||
|
@ -242,7 +243,7 @@ xwl_get_rrmodes_from_connector_id(int drm, int32_t connector_id, int *nmode, int
|
||||||
ErrorF("drmModeGetConnector for connector %d failed\n", connector_id);
|
ErrorF("drmModeGetConnector for connector %d failed\n", connector_id);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
rrmodes = xallocarray(conn->count_modes, sizeof(RRModePtr));
|
rrmodes = calloc(conn->count_modes, sizeof(RRModePtr));
|
||||||
if (!rrmodes) {
|
if (!rrmodes) {
|
||||||
ErrorF("Failed to allocate connector modes\n");
|
ErrorF("Failed to allocate connector modes\n");
|
||||||
drmModeFreeConnector(conn);
|
drmModeFreeConnector(conn);
|
||||||
|
|
|
@ -358,7 +358,8 @@ output_get_rr_modes(struct xwl_output *xwl_output,
|
||||||
RRModePtr *rr_modes;
|
RRModePtr *rr_modes;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
rr_modes = xallocarray(ARRAY_SIZE(xwl_output_fake_modes) + 1, sizeof(RRModePtr));
|
rr_modes = calloc(ARRAY_SIZE(xwl_output_fake_modes) + 1,
|
||||||
|
sizeof(RRModePtr));
|
||||||
if (!rr_modes)
|
if (!rr_modes)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
@ -1229,7 +1230,7 @@ xwl_randr_add_modes_fixed(struct xwl_output *xwl_output,
|
||||||
RRModePtr mode;
|
RRModePtr mode;
|
||||||
int i, nmodes, current;
|
int i, nmodes, current;
|
||||||
|
|
||||||
modes = xallocarray(ARRAY_SIZE(xwl_output_fake_modes) + 1, sizeof(RRModePtr));
|
modes = calloc(ARRAY_SIZE(xwl_output_fake_modes) + 1, sizeof(RRModePtr));
|
||||||
if (!modes) {
|
if (!modes) {
|
||||||
ErrorF("Failed to allocated RandR modes\n");
|
ErrorF("Failed to allocated RandR modes\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -77,8 +77,6 @@ typedef struct _NewClientRec *NewClientPtr;
|
||||||
|
|
||||||
#define xstrdup(s) Xstrdup(s)
|
#define xstrdup(s) Xstrdup(s)
|
||||||
#define xnfstrdup(s) XNFstrdup(s)
|
#define xnfstrdup(s) XNFstrdup(s)
|
||||||
|
|
||||||
#define xallocarray(num, size) reallocarray(NULL, (num), (size))
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
16
mi/miarc.c
16
mi/miarc.c
|
@ -1193,9 +1193,9 @@ miFillSppPoly(DrawablePtr dst, GCPtr pgc, int count, /* number of points */
|
||||||
y = ymax - ymin + 1;
|
y = ymax - ymin + 1;
|
||||||
if ((count < 3) || (y <= 0))
|
if ((count < 3) || (y <= 0))
|
||||||
return;
|
return;
|
||||||
ptsOut = FirstPoint = xallocarray(y, sizeof(DDXPointRec));
|
ptsOut = FirstPoint = calloc(y, sizeof(DDXPointRec));
|
||||||
width = FirstWidth = xallocarray(y, sizeof(int));
|
width = FirstWidth = calloc(y, sizeof(int));
|
||||||
Marked = xallocarray(count, sizeof(int));
|
Marked = calloc(count, sizeof(int));
|
||||||
|
|
||||||
if (!ptsOut || !width || !Marked) {
|
if (!ptsOut || !width || !Marked) {
|
||||||
free(Marked);
|
free(Marked);
|
||||||
|
@ -1895,10 +1895,10 @@ miComputeArcs(xArc * parcs, int narcs, GCPtr pGC)
|
||||||
isDoubleDash = (pGC->lineStyle == LineDoubleDash);
|
isDoubleDash = (pGC->lineStyle == LineDoubleDash);
|
||||||
dashOffset = pGC->dashOffset;
|
dashOffset = pGC->dashOffset;
|
||||||
|
|
||||||
data = xallocarray(narcs, sizeof(struct arcData));
|
data = calloc(narcs, sizeof(struct arcData));
|
||||||
if (!data)
|
if (!data)
|
||||||
return NULL;
|
return NULL;
|
||||||
arcs = xallocarray(isDoubleDash ? 2 : 1, sizeof(*arcs));
|
arcs = calloc(isDoubleDash ? 2 : 1, sizeof(*arcs));
|
||||||
if (!arcs) {
|
if (!arcs) {
|
||||||
free(data);
|
free(data);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -3086,8 +3086,8 @@ fillSpans(DrawablePtr pDrawable, GCPtr pGC)
|
||||||
|
|
||||||
if (nspans == 0)
|
if (nspans == 0)
|
||||||
return;
|
return;
|
||||||
xSpan = xSpans = xallocarray(nspans, sizeof(DDXPointRec));
|
xSpan = xSpans = calloc(nspans, sizeof(DDXPointRec));
|
||||||
xWidth = xWidths = xallocarray(nspans, sizeof(int));
|
xWidth = xWidths = calloc(nspans, sizeof(int));
|
||||||
if (xSpans && xWidths) {
|
if (xSpans && xWidths) {
|
||||||
i = 0;
|
i = 0;
|
||||||
f = finalSpans;
|
f = finalSpans;
|
||||||
|
@ -3141,7 +3141,7 @@ realFindSpan(int y)
|
||||||
else
|
else
|
||||||
change = SPAN_REALLOC;
|
change = SPAN_REALLOC;
|
||||||
newSize = finalSize + change;
|
newSize = finalSize + change;
|
||||||
newSpans = xallocarray(newSize, sizeof(struct finalSpan *));
|
newSpans = calloc(newSize, sizeof(struct finalSpan *));
|
||||||
if (!newSpans)
|
if (!newSpans)
|
||||||
return NULL;
|
return NULL;
|
||||||
newMiny = finalMiny;
|
newMiny = finalMiny;
|
||||||
|
|
|
@ -465,9 +465,9 @@ miInitVisuals(VisualPtr * visualp, DepthPtr * depthp, int *nvisualp,
|
||||||
ndepth++;
|
ndepth++;
|
||||||
nvisual += visuals->count;
|
nvisual += visuals->count;
|
||||||
}
|
}
|
||||||
depth = xallocarray(ndepth, sizeof(DepthRec));
|
depth = calloc(ndepth, sizeof(DepthRec));
|
||||||
visual = xallocarray(nvisual, sizeof(VisualRec));
|
visual = calloc(nvisual, sizeof(VisualRec));
|
||||||
preferredCVCs = xallocarray(ndepth, sizeof(int));
|
preferredCVCs = calloc(ndepth, sizeof(int));
|
||||||
if (!depth || !visual || !preferredCVCs) {
|
if (!depth || !visual || !preferredCVCs) {
|
||||||
free(depth);
|
free(depth);
|
||||||
free(visual);
|
free(visual);
|
||||||
|
@ -488,7 +488,7 @@ miInitVisuals(VisualPtr * visualp, DepthPtr * depthp, int *nvisualp,
|
||||||
prefp++;
|
prefp++;
|
||||||
vid = NULL;
|
vid = NULL;
|
||||||
if (nvtype) {
|
if (nvtype) {
|
||||||
vid = xallocarray(nvtype, sizeof(VisualID));
|
vid = calloc(nvtype, sizeof(VisualID));
|
||||||
if (!vid) {
|
if (!vid) {
|
||||||
free(depth);
|
free(depth);
|
||||||
free(visual);
|
free(visual);
|
||||||
|
|
|
@ -60,7 +60,7 @@ miCopyRegion(DrawablePtr pSrcDrawable,
|
||||||
|
|
||||||
if (nbox > 1) {
|
if (nbox > 1) {
|
||||||
/* keep ordering in each band, reverse order of bands */
|
/* keep ordering in each band, reverse order of bands */
|
||||||
pboxNew1 = xallocarray(nbox, sizeof(BoxRec));
|
pboxNew1 = calloc(nbox, sizeof(BoxRec));
|
||||||
if (!pboxNew1)
|
if (!pboxNew1)
|
||||||
return;
|
return;
|
||||||
pboxBase = pboxNext = pbox + nbox - 1;
|
pboxBase = pboxNext = pbox + nbox - 1;
|
||||||
|
@ -91,7 +91,7 @@ miCopyRegion(DrawablePtr pSrcDrawable,
|
||||||
|
|
||||||
if (nbox > 1) {
|
if (nbox > 1) {
|
||||||
/* reverse order of rects in each band */
|
/* reverse order of rects in each band */
|
||||||
pboxNew2 = xallocarray(nbox, sizeof(BoxRec));
|
pboxNew2 = calloc(nbox, sizeof(BoxRec));
|
||||||
if (!pboxNew2) {
|
if (!pboxNew2) {
|
||||||
free(pboxNew1);
|
free(pboxNew1);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -531,7 +531,7 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
|
||||||
regionnumrects = RegionNumRects(prgn);
|
regionnumrects = RegionNumRects(prgn);
|
||||||
if (regionnumrects == 0)
|
if (regionnumrects == 0)
|
||||||
return;
|
return;
|
||||||
prect = xallocarray(regionnumrects, sizeof(xRectangle));
|
prect = calloc(regionnumrects, sizeof(xRectangle));
|
||||||
if (!prect)
|
if (!prect)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ miPolyGlyphBlt(DrawablePtr pDrawable, GC * pGC, int x, int y, unsigned int nglyp
|
||||||
gcvals);
|
gcvals);
|
||||||
|
|
||||||
nbyLine = BitmapBytePad(width);
|
nbyLine = BitmapBytePad(width);
|
||||||
pbits = xallocarray(height, nbyLine);
|
pbits = calloc(height, nbyLine);
|
||||||
if (!pbits) {
|
if (!pbits) {
|
||||||
dixDestroyPixmap(pPixmap, 0);
|
dixDestroyPixmap(pPixmap, 0);
|
||||||
FreeScratchGC(pGCtmp);
|
FreeScratchGC(pGCtmp);
|
||||||
|
|
|
@ -410,8 +410,8 @@ miFillConvexPoly(DrawablePtr dst, GCPtr pgc, int count, DDXPointPtr ptsIn)
|
||||||
dy = ymax - ymin + 1;
|
dy = ymax - ymin + 1;
|
||||||
if ((count < 3) || (dy < 0))
|
if ((count < 3) || (dy < 0))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
ptsOut = FirstPoint = xallocarray(dy, sizeof(DDXPointRec));
|
ptsOut = FirstPoint = calloc(dy, sizeof(DDXPointRec));
|
||||||
width = FirstWidth = xallocarray(dy, sizeof(int));
|
width = FirstWidth = calloc(dy, sizeof(int));
|
||||||
if (!FirstPoint || !FirstWidth) {
|
if (!FirstPoint || !FirstWidth) {
|
||||||
free(FirstWidth);
|
free(FirstWidth);
|
||||||
free(FirstPoint);
|
free(FirstPoint);
|
||||||
|
|
|
@ -65,7 +65,7 @@ miPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, /* Origin or Previous */
|
||||||
int i;
|
int i;
|
||||||
xPoint *ppt;
|
xPoint *ppt;
|
||||||
|
|
||||||
if (!(pwidthInit = xallocarray(npt, sizeof(int))))
|
if (!(pwidthInit = calloc(npt, sizeof(int))))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* make pointlist origin relative */
|
/* make pointlist origin relative */
|
||||||
|
|
|
@ -86,7 +86,7 @@ miPolyRectangle(DrawablePtr pDraw, GCPtr pGC, int nrects, xRectangle *pRects)
|
||||||
offset2 = pGC->lineWidth;
|
offset2 = pGC->lineWidth;
|
||||||
offset1 = offset2 >> 1;
|
offset1 = offset2 >> 1;
|
||||||
offset3 = offset2 - offset1;
|
offset3 = offset2 - offset1;
|
||||||
tmp = xallocarray(ntmp, sizeof(xRectangle));
|
tmp = calloc(ntmp, sizeof(xRectangle));
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
return;
|
return;
|
||||||
t = tmp;
|
t = tmp;
|
||||||
|
|
|
@ -443,8 +443,8 @@ miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup * spanGroup)
|
||||||
ylength = spanGroup->ymax - ymin + 1;
|
ylength = spanGroup->ymax - ymin + 1;
|
||||||
|
|
||||||
/* Allocate Spans for y buckets */
|
/* Allocate Spans for y buckets */
|
||||||
yspans = xallocarray(ylength, sizeof(Spans));
|
yspans = calloc(ylength, sizeof(Spans));
|
||||||
ysizes = xallocarray(ylength, sizeof(int));
|
ysizes = calloc(ylength, sizeof(int));
|
||||||
|
|
||||||
if (!yspans || !ysizes) {
|
if (!yspans || !ysizes) {
|
||||||
free(yspans);
|
free(yspans);
|
||||||
|
@ -511,8 +511,8 @@ miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup * spanGroup)
|
||||||
} /* for i thorough Spans */
|
} /* for i thorough Spans */
|
||||||
|
|
||||||
/* Now sort by x and uniquify each bucket into the final array */
|
/* Now sort by x and uniquify each bucket into the final array */
|
||||||
points = xallocarray(count, sizeof(DDXPointRec));
|
points = calloc(count, sizeof(DDXPointRec));
|
||||||
widths = xallocarray(count, sizeof(int));
|
widths = calloc(count, sizeof(int));
|
||||||
if (!points || !widths) {
|
if (!points || !widths) {
|
||||||
for (i = 0; i < ylength; i++) {
|
for (i = 0; i < ylength; i++) {
|
||||||
free(yspans[i].points);
|
free(yspans[i].points);
|
||||||
|
@ -559,10 +559,10 @@ miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup * spanGroup)
|
||||||
static Bool
|
static Bool
|
||||||
InitSpans(Spans * spans, size_t nspans)
|
InitSpans(Spans * spans, size_t nspans)
|
||||||
{
|
{
|
||||||
spans->points = xallocarray(nspans, sizeof(*spans->points));
|
spans->points = calloc(nspans, sizeof(*spans->points));
|
||||||
if (!spans->points)
|
if (!spans->points)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
spans->widths = xallocarray(nspans, sizeof(*spans->widths));
|
spans->widths = calloc(nspans, sizeof(*spans->widths));
|
||||||
if (!spans->widths) {
|
if (!spans->widths) {
|
||||||
free(spans->points);
|
free(spans->points);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -671,7 +671,7 @@ miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
|
||||||
numPts = maxPts << 2;
|
numPts = maxPts << 2;
|
||||||
dospans = (pGC->fillStyle != FillSolid);
|
dospans = (pGC->fillStyle != FillSolid);
|
||||||
if (dospans) {
|
if (dospans) {
|
||||||
widths = xallocarray(numPts, sizeof(int));
|
widths = calloc(numPts, sizeof(int));
|
||||||
if (!widths)
|
if (!widths)
|
||||||
return;
|
return;
|
||||||
maxw = 0;
|
maxw = 0;
|
||||||
|
@ -687,7 +687,7 @@ miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
|
||||||
(unsigned char *) pGC->dash, (int) pGC->numInDashList,
|
(unsigned char *) pGC->dash, (int) pGC->numInDashList,
|
||||||
&dinfo.dashOffsetInit);
|
&dinfo.dashOffsetInit);
|
||||||
}
|
}
|
||||||
points = xallocarray(numPts, sizeof(DDXPointRec));
|
points = calloc(numPts, sizeof(DDXPointRec));
|
||||||
if (!points) {
|
if (!points) {
|
||||||
if (dospans) {
|
if (dospans) {
|
||||||
free(widths);
|
free(widths);
|
||||||
|
|
|
@ -148,8 +148,8 @@ miZeroLine(DrawablePtr pDraw, GCPtr pGC, int mode, /* Origin or Previous */
|
||||||
width = xright - xleft + 1;
|
width = xright - xleft + 1;
|
||||||
height = ybottom - ytop + 1;
|
height = ybottom - ytop + 1;
|
||||||
list_len = (height >= width) ? height : width;
|
list_len = (height >= width) ? height : width;
|
||||||
pspanInit = xallocarray(list_len, sizeof(DDXPointRec));
|
pspanInit = calloc(list_len, sizeof(DDXPointRec));
|
||||||
pwidthInit = xallocarray(list_len, sizeof(int));
|
pwidthInit = calloc(list_len, sizeof(int));
|
||||||
if (!pspanInit || !pwidthInit) {
|
if (!pspanInit || !pwidthInit) {
|
||||||
free(pspanInit);
|
free(pspanInit);
|
||||||
free(pwidthInit);
|
free(pwidthInit);
|
||||||
|
|
|
@ -1325,7 +1325,7 @@ damageText(DrawablePtr pDrawable,
|
||||||
if (!checkGCDamage(pDrawable, pGC))
|
if (!checkGCDamage(pDrawable, pGC))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
charinfo = xallocarray(count, sizeof(CharInfoPtr));
|
charinfo = calloc(count, sizeof(CharInfoPtr));
|
||||||
if (!charinfo)
|
if (!charinfo)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -118,6 +118,8 @@ SOFTWARE.
|
||||||
#include "probes.h"
|
#include "probes.h"
|
||||||
#include "xdmcp.h"
|
#include "xdmcp.h"
|
||||||
|
|
||||||
|
#define MAX_CONNECTIONS (1 << 16)
|
||||||
|
|
||||||
struct ospoll *server_poll;
|
struct ospoll *server_poll;
|
||||||
|
|
||||||
Bool NewOutputPending; /* not yet attempted to write some new output */
|
Bool NewOutputPending; /* not yet attempted to write some new output */
|
||||||
|
@ -265,7 +267,12 @@ CreateWellKnownSockets(void)
|
||||||
LogSetDisplay();
|
LogSetDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
ListenTransFds = xallocarray(ListenTransCount, sizeof (int));
|
if (ListenTransCount >= MAX_CONNECTIONS) {
|
||||||
|
FatalError ("Tried to clear too many listening sockets - OOM");
|
||||||
|
return; // mostly to keep GCC from complaining about too large alloc
|
||||||
|
}
|
||||||
|
|
||||||
|
ListenTransFds = calloc(ListenTransCount, sizeof(int));
|
||||||
if (ListenTransFds == NULL)
|
if (ListenTransFds == NULL)
|
||||||
FatalError ("Failed to create listening socket array");
|
FatalError ("Failed to create listening socket array");
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ RRCrtcNotify(RRCrtcPtr crtc,
|
||||||
newoutputs = reallocarray(crtc->outputs,
|
newoutputs = reallocarray(crtc->outputs,
|
||||||
numOutputs, sizeof(RROutputPtr));
|
numOutputs, sizeof(RROutputPtr));
|
||||||
else
|
else
|
||||||
newoutputs = xallocarray(numOutputs, sizeof(RROutputPtr));
|
newoutputs = calloc(numOutputs, sizeof(RROutputPtr));
|
||||||
if (!newoutputs)
|
if (!newoutputs)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1059,7 +1059,7 @@ RRCrtcGammaSetSize(RRCrtcPtr crtc, int size)
|
||||||
if (size == crtc->gammaSize)
|
if (size == crtc->gammaSize)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if (size) {
|
if (size) {
|
||||||
gamma = xallocarray(size, 3 * sizeof(CARD16));
|
gamma = calloc(size, 3 * sizeof(CARD16));
|
||||||
if (!gamma)
|
if (!gamma)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1295,7 +1295,7 @@ ProcRRSetCrtcConfig(ClientPtr client)
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
}
|
}
|
||||||
if (numOutputs) {
|
if (numOutputs) {
|
||||||
outputs = xallocarray(numOutputs, sizeof(RROutputPtr));
|
outputs = calloc(numOutputs, sizeof(RROutputPtr));
|
||||||
if (!outputs)
|
if (!outputs)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,7 +168,7 @@ RRModesForScreen(ScreenPtr pScreen, int *num_ret)
|
||||||
RRModePtr *screen_modes;
|
RRModePtr *screen_modes;
|
||||||
int num_screen_modes = 0;
|
int num_screen_modes = 0;
|
||||||
|
|
||||||
screen_modes = xallocarray((num_modes ? num_modes : 1), sizeof(RRModePtr));
|
screen_modes = calloc((num_modes ? num_modes : 1), sizeof(RRModePtr));
|
||||||
if (!screen_modes)
|
if (!screen_modes)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ RROutputSetClones(RROutputPtr output, RROutputPtr * clones, int numClones)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if (numClones) {
|
if (numClones) {
|
||||||
newClones = xallocarray(numClones, sizeof(RROutputPtr));
|
newClones = calloc(numClones, sizeof(RROutputPtr));
|
||||||
if (!newClones)
|
if (!newClones)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ RROutputSetModes(RROutputPtr output,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numModes) {
|
if (numModes) {
|
||||||
newModes = xallocarray(numModes, sizeof(RRModePtr));
|
newModes = calloc(numModes, sizeof(RRModePtr));
|
||||||
if (!newModes)
|
if (!newModes)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -262,7 +262,7 @@ RROutputSetCrtcs(RROutputPtr output, RRCrtcPtr * crtcs, int numCrtcs)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if (numCrtcs) {
|
if (numCrtcs) {
|
||||||
newCrtcs = xallocarray(numCrtcs, sizeof(RRCrtcPtr));
|
newCrtcs = calloc(numCrtcs, sizeof(RRCrtcPtr));
|
||||||
if (!newCrtcs)
|
if (!newCrtcs)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,7 +207,7 @@ RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type,
|
||||||
if (mode == PropModeReplace || len > 0) {
|
if (mode == PropModeReplace || len > 0) {
|
||||||
void *new_data = NULL, *old_data = NULL;
|
void *new_data = NULL, *old_data = NULL;
|
||||||
|
|
||||||
new_value.data = xallocarray(total_len, size_in_bytes);
|
new_value.data = calloc(total_len, size_in_bytes);
|
||||||
if (!new_value.data && total_len && size_in_bytes) {
|
if (!new_value.data && total_len && size_in_bytes) {
|
||||||
if (add)
|
if (add)
|
||||||
RRDestroyOutputProperty(prop);
|
RRDestroyOutputProperty(prop);
|
||||||
|
@ -379,7 +379,7 @@ RRConfigureOutputProperty(RROutputPtr output, Atom property,
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_values = xallocarray(num_values, sizeof(INT32));
|
new_values = calloc(num_values, sizeof(INT32));
|
||||||
if (!new_values && num_values) {
|
if (!new_values && num_values) {
|
||||||
if (add)
|
if (add)
|
||||||
RRDestroyOutputProperty(prop);
|
RRDestroyOutputProperty(prop);
|
||||||
|
@ -477,7 +477,7 @@ ProcRRQueryOutputProperty(ClientPtr client)
|
||||||
return BadName;
|
return BadName;
|
||||||
|
|
||||||
if (prop->num_valid) {
|
if (prop->num_valid) {
|
||||||
extra = xallocarray(prop->num_valid, sizeof(INT32));
|
extra = calloc(prop->num_valid, sizeof(INT32));
|
||||||
if (!extra)
|
if (!extra)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -347,7 +347,7 @@ RRConfigureProviderProperty(RRProviderPtr provider, Atom property,
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_values = xallocarray(num_values, sizeof(INT32));
|
new_values = calloc(num_values, sizeof(INT32));
|
||||||
if (!new_values && num_values) {
|
if (!new_values && num_values) {
|
||||||
if (add)
|
if (add)
|
||||||
RRDestroyProviderProperty(prop);
|
RRDestroyProviderProperty(prop);
|
||||||
|
@ -396,7 +396,7 @@ ProcRRListProviderProperties(ClientPtr client)
|
||||||
for (prop = provider->properties; prop; prop = prop->next)
|
for (prop = provider->properties; prop; prop = prop->next)
|
||||||
numProps++;
|
numProps++;
|
||||||
if (numProps)
|
if (numProps)
|
||||||
if (!(pAtoms = xallocarray(numProps, sizeof(Atom))))
|
if (!(pAtoms = calloc(numProps, sizeof(Atom))))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
xRRListProviderPropertiesReply rep = {
|
xRRListProviderPropertiesReply rep = {
|
||||||
|
@ -440,7 +440,7 @@ ProcRRQueryProviderProperty(ClientPtr client)
|
||||||
return BadName;
|
return BadName;
|
||||||
|
|
||||||
if (prop->num_valid) {
|
if (prop->num_valid) {
|
||||||
extra = xallocarray(prop->num_valid, sizeof(INT32));
|
extra = calloc(prop->num_valid, sizeof(INT32));
|
||||||
if (!extra)
|
if (!extra)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ RRTransformSetFilter(RRTransformPtr dst,
|
||||||
xFixed *new_params;
|
xFixed *new_params;
|
||||||
|
|
||||||
if (nparams) {
|
if (nparams) {
|
||||||
new_params = xallocarray(nparams, sizeof(xFixed));
|
new_params = calloc(nparams, sizeof(xFixed));
|
||||||
if (!new_params)
|
if (!new_params)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
memcpy(new_params, params, nparams * sizeof(xFixed));
|
memcpy(new_params, params, nparams * sizeof(xFixed));
|
||||||
|
|
|
@ -1086,8 +1086,8 @@ RecordAddClientToRCAP(RecordClientsAndProtocolPtr pRCAP, XID clientspec)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
XID *pNewIDs =
|
XID *pNewIDs =
|
||||||
xallocarray(pRCAP->sizeClients + CLIENT_ARRAY_GROWTH_INCREMENT,
|
calloc(pRCAP->sizeClients + CLIENT_ARRAY_GROWTH_INCREMENT,
|
||||||
sizeof(XID));
|
sizeof(XID));
|
||||||
if (!pNewIDs)
|
if (!pNewIDs)
|
||||||
return;
|
return;
|
||||||
memcpy(pNewIDs, pRCAP->pClientIDs, pRCAP->numClients * sizeof(XID));
|
memcpy(pNewIDs, pRCAP->pClientIDs, pRCAP->numClients * sizeof(XID));
|
||||||
|
@ -1218,7 +1218,7 @@ RecordCanonicalizeClientSpecifiers(XID *pClientspecs, int *pNumClientspecs,
|
||||||
for (i = 0; i < numClients; i++) {
|
for (i = 0; i < numClients; i++) {
|
||||||
if (pClientspecs[i] == XRecordAllClients || pClientspecs[i] == XRecordCurrentClients) { /* expand All/Current */
|
if (pClientspecs[i] == XRecordAllClients || pClientspecs[i] == XRecordCurrentClients) { /* expand All/Current */
|
||||||
int j, nc;
|
int j, nc;
|
||||||
XID *pCanon = xallocarray(currentMaxClients + 1, sizeof(XID));
|
XID *pCanon = calloc(currentMaxClients + 1, sizeof(XID));
|
||||||
|
|
||||||
if (!pCanon)
|
if (!pCanon)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1418,7 +1418,7 @@ static int
|
||||||
RecordAllocIntervals(SetInfoPtr psi, int nIntervals)
|
RecordAllocIntervals(SetInfoPtr psi, int nIntervals)
|
||||||
{
|
{
|
||||||
assert(!psi->intervals);
|
assert(!psi->intervals);
|
||||||
psi->intervals = xallocarray(nIntervals, sizeof(RecordSetInterval));
|
psi->intervals = calloc(nIntervals, sizeof(RecordSetInterval));
|
||||||
if (!psi->intervals)
|
if (!psi->intervals)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
memset(psi->intervals, 0, nIntervals * sizeof(RecordSetInterval));
|
memset(psi->intervals, 0, nIntervals * sizeof(RecordSetInterval));
|
||||||
|
@ -1580,7 +1580,7 @@ RecordRegisterClients(RecordContextPtr pContext, ClientPtr client,
|
||||||
* range for extension replies.
|
* range for extension replies.
|
||||||
*/
|
*/
|
||||||
maxSets = RI_PREDEFSETS + 2 * stuff->nRanges;
|
maxSets = RI_PREDEFSETS + 2 * stuff->nRanges;
|
||||||
si = xallocarray(maxSets, sizeof(SetInfoRec));
|
si = calloc(maxSets, sizeof(SetInfoRec));
|
||||||
if (!si) {
|
if (!si) {
|
||||||
err = BadAlloc;
|
err = BadAlloc;
|
||||||
goto bailout;
|
goto bailout;
|
||||||
|
@ -2145,7 +2145,7 @@ ProcRecordGetContext(ClientPtr client)
|
||||||
|
|
||||||
/* allocate and initialize space for record range info */
|
/* allocate and initialize space for record range info */
|
||||||
|
|
||||||
pRangeInfo = xallocarray(nRCAPs, sizeof(GetContextRangeInfoRec));
|
pRangeInfo = calloc(nRCAPs, sizeof(GetContextRangeInfoRec));
|
||||||
if (!pRangeInfo && nRCAPs > 0)
|
if (!pRangeInfo && nRCAPs > 0)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
for (i = 0; i < nRCAPs; i++) {
|
for (i = 0; i < nRCAPs; i++) {
|
||||||
|
@ -2689,7 +2689,6 @@ RecordAClientStateChange(CallbackListPtr *pcbl, void *nulldata,
|
||||||
NewClientInfoRec *pci = (NewClientInfoRec *) calldata;
|
NewClientInfoRec *pci = (NewClientInfoRec *) calldata;
|
||||||
int i;
|
int i;
|
||||||
ClientPtr pClient = pci->client;
|
ClientPtr pClient = pci->client;
|
||||||
RecordContextPtr *ppAllContextsCopy = NULL;
|
|
||||||
int numContextsCopy = 0;
|
int numContextsCopy = 0;
|
||||||
|
|
||||||
switch (pClient->clientState) {
|
switch (pClient->clientState) {
|
||||||
|
@ -2714,9 +2713,9 @@ RecordAClientStateChange(CallbackListPtr *pcbl, void *nulldata,
|
||||||
/* RecordDisableContext modifies contents of ppAllContexts. */
|
/* RecordDisableContext modifies contents of ppAllContexts. */
|
||||||
if (!(numContextsCopy = numContexts))
|
if (!(numContextsCopy = numContexts))
|
||||||
break;
|
break;
|
||||||
ppAllContextsCopy = xallocarray(numContextsCopy,
|
RecordContextPtr *ppAllContextsCopy = calloc(numContextsCopy, sizeof(RecordContextPtr));
|
||||||
sizeof(RecordContextPtr));
|
if (!ppAllContextsCopy)
|
||||||
assert(ppAllContextsCopy);
|
return;
|
||||||
memcpy(ppAllContextsCopy, ppAllContexts,
|
memcpy(ppAllContextsCopy, ppAllContexts,
|
||||||
numContextsCopy * sizeof(RecordContextPtr));
|
numContextsCopy * sizeof(RecordContextPtr));
|
||||||
|
|
||||||
|
|
|
@ -312,7 +312,7 @@ IntervalListCreateSet(RecordSetInterval * pIntervals, int nIntervals,
|
||||||
CARD16 first;
|
CARD16 first;
|
||||||
|
|
||||||
if (nIntervals > 0) {
|
if (nIntervals > 0) {
|
||||||
stackIntervals = xallocarray(nIntervals, sizeof(RecordSetInterval));
|
stackIntervals = calloc(nIntervals, sizeof(RecordSetInterval));
|
||||||
if (!stackIntervals)
|
if (!stackIntervals)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
|
@ -378,7 +378,7 @@ SetPicturePictFilter(PicturePtr pPicture, PictFilterPtr pFilter,
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
|
|
||||||
if (nparams != pPicture->filter_nparams) {
|
if (nparams != pPicture->filter_nparams) {
|
||||||
xFixed *new_params = xallocarray(nparams, sizeof(xFixed));
|
xFixed *new_params = calloc(nparams, sizeof(xFixed));
|
||||||
|
|
||||||
if (!new_params && nparams)
|
if (!new_params && nparams)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
|
@ -254,7 +254,7 @@ miInitIndexed(ScreenPtr pScreen, PictFormatPtr pFormat)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
pFormat->index.nvalues = num;
|
pFormat->index.nvalues = num;
|
||||||
pFormat->index.pValues = xallocarray(num, sizeof(xIndexValue));
|
pFormat->index.pValues = calloc(num, sizeof(xIndexValue));
|
||||||
if (!pFormat->index.pValues) {
|
if (!pFormat->index.pValues) {
|
||||||
free(pIndexed);
|
free(pIndexed);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -508,7 +508,7 @@ miTriStrip(CARD8 op,
|
||||||
int ntri;
|
int ntri;
|
||||||
|
|
||||||
ntri = npoints - 2;
|
ntri = npoints - 2;
|
||||||
tris = xallocarray(ntri, sizeof(xTriangle));
|
tris = calloc(ntri, sizeof(xTriangle));
|
||||||
if (!tris)
|
if (!tris)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -533,7 +533,7 @@ miTriFan(CARD8 op,
|
||||||
int ntri;
|
int ntri;
|
||||||
|
|
||||||
ntri = npoints - 2;
|
ntri = npoints - 2;
|
||||||
tris = xallocarray(ntri, sizeof(xTriangle));
|
tris = calloc(ntri, sizeof(xTriangle));
|
||||||
if (!tris)
|
if (!tris)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -825,7 +825,7 @@ initGradient(SourcePictPtr pGradient, int stopCount,
|
||||||
dpos = stopPoints[i];
|
dpos = stopPoints[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
pGradient->gradient.stops = xallocarray(stopCount, sizeof(PictGradientStop));
|
pGradient->gradient.stops = calloc(stopCount, sizeof(PictGradientStop));
|
||||||
if (!pGradient->gradient.stops) {
|
if (!pGradient->gradient.stops) {
|
||||||
*error = BadAlloc;
|
*error = BadAlloc;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1316,14 +1316,14 @@ ProcRenderCompositeGlyphs(ClientPtr client)
|
||||||
if (nglyph <= NLOCALGLYPH)
|
if (nglyph <= NLOCALGLYPH)
|
||||||
glyphsBase = glyphsLocal;
|
glyphsBase = glyphsLocal;
|
||||||
else {
|
else {
|
||||||
glyphsBase = xallocarray(nglyph, sizeof(GlyphPtr));
|
glyphsBase = calloc(nglyph, sizeof(GlyphPtr));
|
||||||
if (!glyphsBase)
|
if (!glyphsBase)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
if (nlist <= NLOCALDELTA)
|
if (nlist <= NLOCALDELTA)
|
||||||
listsBase = listsLocal;
|
listsBase = listsLocal;
|
||||||
else {
|
else {
|
||||||
listsBase = xallocarray(nlist, sizeof(GlyphListRec));
|
listsBase = calloc(nlist, sizeof(GlyphListRec));
|
||||||
if (!listsBase) {
|
if (!listsBase) {
|
||||||
rc = BadAlloc;
|
rc = BadAlloc;
|
||||||
goto bail;
|
goto bail;
|
||||||
|
@ -1799,7 +1799,7 @@ ProcRenderCreateAnimCursor(ClientPtr client)
|
||||||
ncursor =
|
ncursor =
|
||||||
(client->req_len -
|
(client->req_len -
|
||||||
(bytes_to_int32(sizeof(xRenderCreateAnimCursorReq)))) >> 1;
|
(bytes_to_int32(sizeof(xRenderCreateAnimCursorReq)))) >> 1;
|
||||||
cursors = xallocarray(ncursor, sizeof(CursorPtr) + sizeof(CARD32));
|
cursors = calloc(ncursor, sizeof(CursorPtr) + sizeof(CARD32));
|
||||||
if (!cursors)
|
if (!cursors)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
deltas = (CARD32 *) (cursors + ncursor);
|
deltas = (CARD32 *) (cursors + ncursor);
|
||||||
|
|
|
@ -746,7 +746,7 @@ ProcXFixesExpandRegion(ClientPtr client)
|
||||||
nBoxes = RegionNumRects(pSource);
|
nBoxes = RegionNumRects(pSource);
|
||||||
pSrc = RegionRects(pSource);
|
pSrc = RegionRects(pSource);
|
||||||
if (nBoxes) {
|
if (nBoxes) {
|
||||||
pTmp = xallocarray(nBoxes, sizeof(BoxRec));
|
pTmp = calloc(nBoxes, sizeof(BoxRec));
|
||||||
if (!pTmp)
|
if (!pTmp)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
for (i = 0; i < nBoxes; i++) {
|
for (i = 0; i < nBoxes; i++) {
|
||||||
|
|
|
@ -93,7 +93,7 @@ InputLineAddChar(InputLine * line, int ch)
|
||||||
{
|
{
|
||||||
if (line->num_line >= line->sz_line) {
|
if (line->num_line >= line->sz_line) {
|
||||||
if (line->line == line->buf) {
|
if (line->line == line->buf) {
|
||||||
line->line = xallocarray(line->sz_line, 2);
|
line->line = calloc(line->sz_line, 2);
|
||||||
memcpy(line->line, line->buf, line->sz_line);
|
memcpy(line->line, line->buf, line->sz_line);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -896,11 +896,15 @@ XkbRF_AddRule(XkbRF_RulesPtr rules)
|
||||||
rules->sz_rules = 16;
|
rules->sz_rules = 16;
|
||||||
rules->num_rules = 0;
|
rules->num_rules = 0;
|
||||||
rules->rules = calloc(rules->sz_rules, sizeof(XkbRF_RuleRec));
|
rules->rules = calloc(rules->sz_rules, sizeof(XkbRF_RuleRec));
|
||||||
|
if (!(rules->rules))
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
else if (rules->num_rules >= rules->sz_rules) {
|
else if (rules->num_rules >= rules->sz_rules) {
|
||||||
rules->sz_rules *= 2;
|
rules->sz_rules *= 2;
|
||||||
rules->rules = reallocarray(rules->rules,
|
rules->rules = reallocarray(rules->rules,
|
||||||
rules->sz_rules, sizeof(XkbRF_RuleRec));
|
rules->sz_rules, sizeof(XkbRF_RuleRec));
|
||||||
|
if (!(rules->rules))
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
if (!rules->rules) {
|
if (!rules->rules) {
|
||||||
rules->sz_rules = rules->num_rules = 0;
|
rules->sz_rules = rules->num_rules = 0;
|
||||||
|
@ -918,11 +922,15 @@ XkbRF_AddGroup(XkbRF_RulesPtr rules)
|
||||||
rules->sz_groups = 16;
|
rules->sz_groups = 16;
|
||||||
rules->num_groups = 0;
|
rules->num_groups = 0;
|
||||||
rules->groups = calloc(rules->sz_groups, sizeof(XkbRF_GroupRec));
|
rules->groups = calloc(rules->sz_groups, sizeof(XkbRF_GroupRec));
|
||||||
|
if (!(rules->groups))
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
else if (rules->num_groups >= rules->sz_groups) {
|
else if (rules->num_groups >= rules->sz_groups) {
|
||||||
rules->sz_groups *= 2;
|
rules->sz_groups *= 2;
|
||||||
rules->groups = reallocarray(rules->groups,
|
rules->groups = reallocarray(rules->groups,
|
||||||
rules->sz_groups, sizeof(XkbRF_GroupRec));
|
rules->sz_groups, sizeof(XkbRF_GroupRec));
|
||||||
|
if (!(rules->groups))
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
if (!rules->groups) {
|
if (!rules->groups) {
|
||||||
rules->sz_groups = rules->num_groups = 0;
|
rules->sz_groups = rules->num_groups = 0;
|
||||||
|
|
|
@ -2837,7 +2837,7 @@ XkbSendCompatMap(ClientPtr client,
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
if (rep->length > 0) {
|
if (rep->length > 0) {
|
||||||
data = xallocarray(rep->length, 4);
|
data = calloc(rep->length, 4);
|
||||||
if (data) {
|
if (data) {
|
||||||
register unsigned i, bit;
|
register unsigned i, bit;
|
||||||
xkbModsWireDesc *grp;
|
xkbModsWireDesc *grp;
|
||||||
|
@ -3224,7 +3224,7 @@ XkbSendIndicatorMap(ClientPtr client,
|
||||||
if (rep->length > 0) {
|
if (rep->length > 0) {
|
||||||
CARD8 *to;
|
CARD8 *to;
|
||||||
|
|
||||||
to = map = xallocarray(rep->length, 4);
|
to = map = calloc(rep->length, 4);
|
||||||
if (map) {
|
if (map) {
|
||||||
xkbIndicatorMapWireDesc *wire = (xkbIndicatorMapWireDesc *) to;
|
xkbIndicatorMapWireDesc *wire = (xkbIndicatorMapWireDesc *) to;
|
||||||
|
|
||||||
|
@ -5036,7 +5036,7 @@ XkbSendGeometry(ClientPtr client,
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
if (geom != NULL) {
|
if (geom != NULL) {
|
||||||
start = desc = xallocarray(rep->length, 4);
|
start = desc = calloc(rep->length, 4);
|
||||||
if (!start)
|
if (!start)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
len = rep->length * 4;
|
len = rep->length * 4;
|
||||||
|
|
|
@ -1065,8 +1065,8 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
|
||||||
}
|
}
|
||||||
else if (!dtype->map_count || !dtype->map ||
|
else if (!dtype->map_count || !dtype->map ||
|
||||||
i >= dst->map->num_types) {
|
i >= dst->map->num_types) {
|
||||||
tmp = xallocarray(stype->map_count,
|
tmp = calloc(stype->map_count,
|
||||||
sizeof(XkbKTMapEntryRec));
|
sizeof(XkbKTMapEntryRec));
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
dtype->map = tmp;
|
dtype->map = tmp;
|
||||||
|
@ -1094,8 +1094,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
|
||||||
}
|
}
|
||||||
else if (!dtype->preserve || !dtype->map_count ||
|
else if (!dtype->preserve || !dtype->map_count ||
|
||||||
i >= dst->map->num_types) {
|
i >= dst->map->num_types) {
|
||||||
tmp = xallocarray(stype->map_count,
|
tmp = calloc(stype->map_count, sizeof(XkbModsRec));
|
||||||
sizeof(XkbModsRec));
|
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
dtype->preserve = tmp;
|
dtype->preserve = tmp;
|
||||||
|
@ -1605,8 +1604,8 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
|
||||||
j < sshape->num_outlines;
|
j < sshape->num_outlines;
|
||||||
j++, soutline++, doutline++) {
|
j++, soutline++, doutline++) {
|
||||||
if (soutline->num_points) {
|
if (soutline->num_points) {
|
||||||
tmp = xallocarray(soutline->num_points,
|
tmp = calloc(soutline->num_points,
|
||||||
sizeof(XkbPointRec));
|
sizeof(XkbPointRec));
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
doutline->points = tmp;
|
doutline->points = tmp;
|
||||||
|
@ -1733,7 +1732,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
|
||||||
for (j = 0, srow = ssection->rows, drow = dsection->rows;
|
for (j = 0, srow = ssection->rows, drow = dsection->rows;
|
||||||
j < ssection->num_rows; j++, srow++, drow++) {
|
j < ssection->num_rows; j++, srow++, drow++) {
|
||||||
if (srow->num_keys) {
|
if (srow->num_keys) {
|
||||||
tmp = xallocarray(srow->num_keys, sizeof(XkbKeyRec));
|
tmp = calloc(srow->num_keys, sizeof(XkbKeyRec));
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
drow->keys = tmp;
|
drow->keys = tmp;
|
||||||
|
|
Loading…
Reference in New Issue