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/shape.c | 50 ++++++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 22 deletions(-) (limited to 'Xext/shape.c') diff --git a/Xext/shape.c b/Xext/shape.c index 7724e7bb2..ecc6c8817 100644 --- a/Xext/shape.c +++ b/Xext/shape.c @@ -204,15 +204,16 @@ CreateClipShape(WindowPtr pWin) static int ProcShapeQueryVersion(ClientPtr client) { - xShapeQueryVersionReply rep; + xShapeQueryVersionReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .majorVersion = SERVER_SHAPE_MAJOR_VERSION, + .minorVersion = SERVER_SHAPE_MINOR_VERSION + }; REQUEST_SIZE_MATCH(xShapeQueryVersionReq); - memset(&rep, 0, sizeof(xShapeQueryVersionReply)); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.majorVersion = SERVER_SHAPE_MAJOR_VERSION; - rep.minorVersion = SERVER_SHAPE_MINOR_VERSION; + if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); @@ -631,12 +632,13 @@ ProcShapeQueryExtents(ClientPtr client) rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; - memset(&rep, 0, sizeof(xShapeQueryExtentsReply)); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.boundingShaped = (wBoundingShape(pWin) != 0); - rep.clipShaped = (wClipShape(pWin) != 0); + rep = (xShapeQueryExtentsReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .boundingShaped = (wBoundingShape(pWin) != 0), + .clipShaped = (wClipShape(pWin) != 0) + }; if ((region = wBoundingShape(pWin))) { /* this is done in two steps because of a compiler bug on SunOS 4.1.3 */ pExtents = RegionExtents(region); @@ -920,10 +922,12 @@ ProcShapeInputSelected(ClientPtr client) } } } - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.enabled = enabled; + rep = (xShapeInputSelectedReply) { + .type = X_Reply, + .enabled = enabled, + .sequenceNumber = client->sequence, + .length = 0 + }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); @@ -1001,11 +1005,13 @@ ProcShapeGetRectangles(ClientPtr client) rects[i].height = box->y2 - box->y1; } } - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - rep.length = bytes_to_int32(nrects * sizeof(xRectangle)); - rep.ordering = YXBanded; - rep.nrects = nrects; + rep = (xShapeGetRectanglesReply) { + .type = X_Reply, + .ordering = YXBanded, + .sequenceNumber = client->sequence, + .length = bytes_to_int32(nrects * sizeof(xRectangle)), + .nrects = nrects + }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); -- cgit v1.2.3