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/rrscreen.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/rrscreen.c')
-rw-r--r-- | randr/rrscreen.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/randr/rrscreen.c b/randr/rrscreen.c index ec07bb167..236794aff 100644 --- a/randr/rrscreen.c +++ b/randr/rrscreen.c @@ -882,6 +882,7 @@ ProcRRSetScreenConfig(ClientPtr client) Rotation rotation; int rate; Bool has_rate; + CARD8 status; RROutputPtr output; RRCrtcPtr crtc; RRModePtr mode; @@ -912,7 +913,7 @@ ProcRRSetScreenConfig(ClientPtr client) if (!pScrPriv) { time = currentTime; - rep.status = RRSetConfigFailed; + status = RRSetConfigFailed; goto sendReply; } if (!RRGetInfo(pScreen, FALSE)) @@ -921,7 +922,7 @@ ProcRRSetScreenConfig(ClientPtr client) output = RRFirstOutput(pScreen); if (!output) { time = currentTime; - rep.status = RRSetConfigFailed; + status = RRSetConfigFailed; goto sendReply; } @@ -937,7 +938,7 @@ ProcRRSetScreenConfig(ClientPtr client) * stop working after several hours have passed (freedesktop bug #6502). */ if (stuff->configTimestamp != pScrPriv->lastConfigTime.milliseconds) { - rep.status = RRSetConfigInvalidConfigTime; + status = RRSetConfigInvalidConfigTime; goto sendReply; } @@ -1016,7 +1017,7 @@ ProcRRSetScreenConfig(ClientPtr client) * the last set-time */ if (CompareTimeStamps(time, pScrPriv->lastSetTime) < 0) { - rep.status = RRSetConfigInvalidTime; + status = RRSetConfigInvalidTime; goto sendReply; } @@ -1048,24 +1049,24 @@ ProcRRSetScreenConfig(ClientPtr client) for (c = 0; c < pScrPriv->numCrtcs; c++) { if (!RRCrtcSet(pScrPriv->crtcs[c], NULL, 0, 0, RR_Rotate_0, 0, NULL)) { - rep.status = RRSetConfigFailed; + status = RRSetConfigFailed; /* XXX recover from failure */ goto sendReply; } } if (!RRScreenSizeSet(pScreen, width, height, pScreen->mmWidth, pScreen->mmHeight)) { - rep.status = RRSetConfigFailed; + status = RRSetConfigFailed; /* XXX recover from failure */ goto sendReply; } } if (!RRCrtcSet(crtc, mode, 0, 0, stuff->rotation, 1, &output)) - rep.status = RRSetConfigFailed; + status = RRSetConfigFailed; else { pScrPriv->lastSetTime = time; - rep.status = RRSetConfigSuccess; + status = RRSetConfigSuccess; } /* @@ -1077,7 +1078,7 @@ ProcRRSetScreenConfig(ClientPtr client) free(pData); rep.type = X_Reply; - /* rep.status has already been filled in */ + rep.status = status; rep.length = 0; rep.sequenceNumber = client->sequence; |