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 /dix/dispatch.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 'dix/dispatch.c')
-rw-r--r-- | dix/dispatch.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/dix/dispatch.c b/dix/dispatch.c index 4231cb0ac..787f87f72 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -2801,17 +2801,21 @@ ProcLookupColor(ClientPtr client) rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP, client, DixReadAccess); if (rc == Success) { - xLookupColorReply lcr; + CARD16 exactRed, exactGreen, exactBlue; if (OsLookupColor (pcmp->pScreen->myNum, (char *) &stuff[1], stuff->nbytes, - &lcr.exactRed, &lcr.exactGreen, &lcr.exactBlue)) { + &exactRed, &exactGreen, &exactBlue)) { + xLookupColorReply lcr; lcr.type = X_Reply; lcr.length = 0; lcr.sequenceNumber = client->sequence; - lcr.screenRed = lcr.exactRed; - lcr.screenGreen = lcr.exactGreen; - lcr.screenBlue = lcr.exactBlue; + lcr.exactRed = exactRed; + lcr.exactGreen = exactGreen; + lcr.exactBlue = exactBlue; + lcr.screenRed = exactRed; + lcr.screenGreen = exactGreen; + lcr.screenBlue = exactBlue; (*pcmp->pScreen->ResolveColor) (&lcr.screenRed, &lcr.screenGreen, &lcr.screenBlue, pcmp->pVisual); @@ -3109,6 +3113,7 @@ ProcListHosts(ClientPtr client) { xListHostsReply reply; int len, nHosts, result; + BOOL enabled; pointer pdata; /* REQUEST(xListHostsReq); */ @@ -3120,10 +3125,11 @@ ProcListHosts(ClientPtr client) if (result != Success) return result; - result = GetHosts(&pdata, &nHosts, &len, &reply.enabled); + result = GetHosts(&pdata, &nHosts, &len, &enabled); if (result != Success) return result; reply.type = X_Reply; + reply.enabled = enabled; reply.sequenceNumber = client->sequence; reply.nHosts = nHosts; reply.length = bytes_to_int32(len); |