From 6a721e3af5e11bae1d59ca551a02470f35d9e844 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 9 Jul 2012 19:12:43 -0700 Subject: Use C99 designated initializers in Xext Replies Signed-off-by: Alan Coopersmith Reviewed-by: Keith Packard Tested-by: Daniel Stone --- Xext/xcmisc.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) (limited to 'Xext/xcmisc.c') diff --git a/Xext/xcmisc.c b/Xext/xcmisc.c index 943b424c0..9e4ea896e 100644 --- a/Xext/xcmisc.c +++ b/Xext/xcmisc.c @@ -45,14 +45,16 @@ from The Open Group. static int ProcXCMiscGetVersion(ClientPtr client) { - xXCMiscGetVersionReply rep; + xXCMiscGetVersionReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .majorVersion = XCMiscMajorVersion, + .minorVersion = XCMiscMinorVersion + }; REQUEST_SIZE_MATCH(xXCMiscGetVersionReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.majorVersion = XCMiscMajorVersion; - rep.minorVersion = XCMiscMinorVersion; + if (client->swapped) { swaps(&rep.sequenceNumber); swaps(&rep.majorVersion); @@ -70,11 +72,13 @@ ProcXCMiscGetXIDRange(ClientPtr client) REQUEST_SIZE_MATCH(xXCMiscGetXIDRangeReq); GetXIDRange(client->index, FALSE, &min_id, &max_id); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.start_id = min_id; - rep.count = max_id - min_id + 1; + rep = (xXCMiscGetXIDRangeReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .start_id = min_id, + .count = max_id - min_id + 1 + }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.start_id); @@ -102,10 +106,12 @@ ProcXCMiscGetXIDList(ClientPtr client) return BadAlloc; } count = GetXIDList(client, stuff->count, pids); - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - rep.length = count; - rep.count = count; + rep = (xXCMiscGetXIDListReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = count, + .count = count + }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); -- cgit v1.2.3