diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2015-03-21 13:42:12 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2015-04-21 16:57:08 -0700 |
commit | 1c56ac63c040280498c4a9d67b48c35b60070821 (patch) | |
tree | ab1073d348cb1acf0523ede3e1f2fa73f3b5fdb6 /Xext/panoramiXprocs.c | |
parent | b9e665c8b2f048feb3064ce412e0b3e9eb6797b0 (diff) |
Convert top level extensions to new *allocarray functions
v2: remove now useless parentheses
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'Xext/panoramiXprocs.c')
-rw-r--r-- | Xext/panoramiXprocs.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c index 5291a4a4b..9eb29bd74 100644 --- a/Xext/panoramiXprocs.c +++ b/Xext/panoramiXprocs.c @@ -1341,7 +1341,7 @@ PanoramiXPolyPoint(ClientPtr client) isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyPointReq)); if (npoint > 0) { - origPts = malloc(npoint * sizeof(xPoint)); + origPts = xallocarray(npoint, sizeof(xPoint)); memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint)); FOR_NSCREENS_FORWARD(j) { @@ -1406,7 +1406,7 @@ PanoramiXPolyLine(ClientPtr client) isRoot = IS_ROOT_DRAWABLE(draw); npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyLineReq)); if (npoint > 0) { - origPts = malloc(npoint * sizeof(xPoint)); + origPts = xallocarray(npoint, sizeof(xPoint)); memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint)); FOR_NSCREENS_FORWARD(j) { @@ -1475,7 +1475,7 @@ PanoramiXPolySegment(ClientPtr client) return BadLength; nsegs >>= 3; if (nsegs > 0) { - origSegs = malloc(nsegs * sizeof(xSegment)); + origSegs = xallocarray(nsegs, sizeof(xSegment)); memcpy((char *) origSegs, (char *) &stuff[1], nsegs * sizeof(xSegment)); FOR_NSCREENS_FORWARD(j) { @@ -1543,7 +1543,7 @@ PanoramiXPolyRectangle(ClientPtr client) return BadLength; nrects >>= 3; if (nrects > 0) { - origRecs = malloc(nrects * sizeof(xRectangle)); + origRecs = xallocarray(nrects, sizeof(xRectangle)); memcpy((char *) origRecs, (char *) &stuff[1], nrects * sizeof(xRectangle)); FOR_NSCREENS_FORWARD(j) { @@ -1610,7 +1610,7 @@ PanoramiXPolyArc(ClientPtr client) return BadLength; narcs /= sizeof(xArc); if (narcs > 0) { - origArcs = malloc(narcs * sizeof(xArc)); + origArcs = xallocarray(narcs, sizeof(xArc)); memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc)); FOR_NSCREENS_FORWARD(j) { @@ -1672,7 +1672,7 @@ PanoramiXFillPoly(ClientPtr client) count = bytes_to_int32((client->req_len << 2) - sizeof(xFillPolyReq)); if (count > 0) { - locPts = malloc(count * sizeof(DDXPointRec)); + locPts = xallocarray(count, sizeof(DDXPointRec)); memcpy((char *) locPts, (char *) &stuff[1], count * sizeof(DDXPointRec)); FOR_NSCREENS_FORWARD(j) { @@ -1741,7 +1741,7 @@ PanoramiXPolyFillRectangle(ClientPtr client) return BadLength; things >>= 3; if (things > 0) { - origRects = malloc(things * sizeof(xRectangle)); + origRects = xallocarray(things, sizeof(xRectangle)); memcpy((char *) origRects, (char *) &stuff[1], things * sizeof(xRectangle)); FOR_NSCREENS_FORWARD(j) { @@ -1808,7 +1808,7 @@ PanoramiXPolyFillArc(ClientPtr client) return BadLength; narcs /= sizeof(xArc); if (narcs > 0) { - origArcs = malloc(narcs * sizeof(xArc)); + origArcs = xallocarray(narcs, sizeof(xArc)); memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc)); FOR_NSCREENS_FORWARD(j) { @@ -1988,8 +1988,7 @@ PanoramiXGetImage(ClientPtr client) if (linesPerBuf > h) linesPerBuf = h; } - length = linesPerBuf * widthBytesLine; - if (!(pBuf = malloc(length))) + if (!(pBuf = xallocarray(linesPerBuf, widthBytesLine))) return BadAlloc; WriteReplyToClient(client, sizeof(xGetImageReply), &xgi); |