diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2012-07-09 19:12:42 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2012-07-09 19:14:50 -0700 |
commit | 5b86c072d1d586ce040d8831a05cf97ff8b17821 (patch) | |
tree | 0652f715c003f9c61044b09a288d235ff92d81f3 /randr/rrxinerama.c | |
parent | c2fb1a7b2ab58d70b38ee03ab2fdeb4e7183a356 (diff) |
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>
Diffstat (limited to 'randr/rrxinerama.c')
-rw-r--r-- | randr/rrxinerama.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/randr/rrxinerama.c b/randr/rrxinerama.c index 269a63f78..da3942f6a 100644 --- a/randr/rrxinerama.c +++ b/randr/rrxinerama.c @@ -299,16 +299,19 @@ ProcRRXineramaQueryScreens(ClientPtr client) { xXineramaQueryScreensReply rep; ScreenPtr pScreen = screenInfo.screens[RR_XINERAMA_SCREEN]; + int n = 0; REQUEST_SIZE_MATCH(xXineramaQueryScreensReq); - if (RRXineramaScreenActive(pScreen)) + if (RRXineramaScreenActive(pScreen)) { RRGetInfo(pScreen, FALSE); + n = RRXineramaScreenCount(pScreen); + } rep.type = X_Reply; rep.sequenceNumber = client->sequence; - rep.number = RRXineramaScreenCount(pScreen); - rep.length = bytes_to_int32(rep.number * sz_XineramaScreenInfo); + rep.number = n; + rep.length = bytes_to_int32(n * sz_XineramaScreenInfo); if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); @@ -316,7 +319,7 @@ ProcRRXineramaQueryScreens(ClientPtr client) } WriteToClient(client, sizeof(xXineramaQueryScreensReply), &rep); - if (rep.number) { + if (n) { rrScrPriv(pScreen); int i; int has_primary = 0; |