Use temporary variables instead of parts of reply structures

When passing variable pointers to functions or otherwise doing long
sequences to compute values for replies, create & use some new
temporary variables, to allow for simpler initialization of reply
structures in the following patches.

Move memsets & other initializations to group with the rest of the
filling in of the reply structure, now that they're not needed so
early in the code path.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Tested-by: Daniel Stone <daniel@fooishbar.org>
This commit is contained in:
Alan Coopersmith 2012-07-09 19:12:42 -07:00
commit 5b86c072d1
10 changed files with 77 additions and 48 deletions

View file

@ -616,6 +616,7 @@ ProcShmGetImage(ClientPtr client)
Mask plane = 0;
xShmGetImageReply xgi;
ShmDescPtr shmdesc;
VisualID visual = None;
int rc;
REQUEST(xShmGetImageReq);
@ -646,18 +647,19 @@ ProcShmGetImage(ClientPtr client)
stuff->y + (int) stuff->height >
wBorderWidth((WindowPtr) pDraw) + (int) pDraw->height)
return BadMatch;
xgi.visual = wVisual(((WindowPtr) pDraw));
visual = wVisual(((WindowPtr) pDraw));
}
else {
if (stuff->x < 0 ||
stuff->x + (int) stuff->width > pDraw->width ||
stuff->y < 0 || stuff->y + (int) stuff->height > pDraw->height)
return BadMatch;
xgi.visual = None;
visual = None;
}
xgi.type = X_Reply;
xgi.length = 0;
xgi.sequenceNumber = client->sequence;
xgi.visual = visual;
xgi.depth = pDraw->depth;
if (stuff->format == ZPixmap) {
length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height;