mirror of
https://github.com/X11Libre/xserver.git
synced 2026-10-01 22:03:09 +00:00
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:
parent
c2fb1a7b2a
commit
5b86c072d1
10 changed files with 77 additions and 48 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue