summaryrefslogtreecommitdiff
path: root/record/record.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2012-07-09 19:12:42 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2012-07-09 19:14:50 -0700
commit5b86c072d1d586ce040d8831a05cf97ff8b17821 (patch)
tree0652f715c003f9c61044b09a288d235ff92d81f3 /record/record.c
parentc2fb1a7b2ab58d70b38ee03ab2fdeb4e7183a356 (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 'record/record.c')
-rw-r--r--record/record.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/record/record.c b/record/record.c
index a3ee4dd3d..54a0e68dd 100644
--- a/record/record.c
+++ b/record/record.c
@@ -2135,6 +2135,7 @@ ProcRecordGetContext(ClientPtr client)
GetContextRangeInfoPtr pri;
int i;
int err;
+ CARD32 nClients, length;
REQUEST_SIZE_MATCH(xRecordGetContextReq);
VERIFY_CONTEXT(pContext, stuff->context, client);
@@ -2218,12 +2219,12 @@ ProcRecordGetContext(ClientPtr client)
/* calculate number of clients and reply length */
- rep.nClients = 0;
- rep.length = 0;
+ nClients = 0;
+ length = 0;
for (pRCAP = pContext->pListOfRCAP, pri = pRangeInfo;
pRCAP; pRCAP = pRCAP->pNextRCAP, pri++) {
- rep.nClients += pRCAP->numClients;
- rep.length += pRCAP->numClients *
+ nClients += pRCAP->numClients;
+ length += pRCAP->numClients *
(bytes_to_int32(sizeof(xRecordClientInfo)) +
pri->nRanges * bytes_to_int32(sizeof(xRecordRange)));
}
@@ -2232,8 +2233,10 @@ ProcRecordGetContext(ClientPtr client)
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
+ rep.length = length;
rep.enabled = pContext->pRecordingClient != NULL;
rep.elementHeader = pContext->elemHeaders;
+ rep.nClients = nClients;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);