[PATCH 05/19] Use C99 designated initializers in Xext Replies

Alan Coopersmith alan.coopersmith at oracle.com
Sun Jun 24 10:25:12 PDT 2012


Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 Xext/bigreq.c         |   28 ++++----
 Xext/dpms.c           |   55 +++++++--------
 Xext/geext.c          |   20 +++---
 Xext/panoramiX.c      |  143 +++++++++++++++++++-------------------
 Xext/panoramiXprocs.c |   40 ++++++-----
 Xext/saver.c          |   23 ++++---
 Xext/security.c       |   47 +++++++------
 Xext/shape.c          |   73 +++++++++++---------
 Xext/shm.c            |   41 +++++------
 Xext/sync.c           |  180 +++++++++++++++++++++++++-----------------------
 Xext/xcmisc.c         |   77 +++++++++++----------
 Xext/xf86bigfont.c    |   37 +++++-----
 Xext/xres.c           |  115 +++++++++++++++++--------------
 Xext/xselinux_ext.c   |   64 +++++++++--------
 Xext/xtest.c          |   33 +++++----
 Xext/xvdisp.c         |  160 ++++++++++++++++++++++++-------------------
 Xext/xvmc.c           |  182 +++++++++++++++++++++++++++----------------------
 17 files changed, 709 insertions(+), 609 deletions(-)

diff --git a/Xext/bigreq.c b/Xext/bigreq.c
index 9bb1c86..c58dacb 100644
--- a/Xext/bigreq.c
+++ b/Xext/bigreq.c
@@ -46,26 +46,28 @@ static int
 ProcBigReqDispatch(ClientPtr client)
 {
     REQUEST(xBigReqEnableReq);
-    xBigReqEnableReply rep;
 
     if (client->swapped) {
         swaps(&stuff->length);
     }
     if (stuff->brReqType != X_BigReqEnable)
         return BadRequest;
-    REQUEST_SIZE_MATCH(xBigReqEnableReq);
-    client->big_requests = TRUE;
-    memset(&rep, 0, sizeof(xBigReqEnableReply));
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.max_request_size = maxBigRequestSize;
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.max_request_size);
+    else {
+        xBigReqEnableReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .max_request_size = maxBigRequestSize
+        };
+        REQUEST_SIZE_MATCH(xBigReqEnableReq);
+        client->big_requests = TRUE;
+        if (client->swapped) {
+            swaps(&rep.sequenceNumber);
+            swapl(&rep.max_request_size);
+        }
+        WriteToClient(client, sizeof(xBigReqEnableReply), &rep);
+        return Success;
     }
-    WriteToClient(client, sizeof(xBigReqEnableReply), &rep);
-    return Success;
 }
 
 void
diff --git a/Xext/dpms.c b/Xext/dpms.c
index 35be966..8ec32ea 100644
--- a/Xext/dpms.c
+++ b/Xext/dpms.c
@@ -45,15 +45,16 @@ static int
 ProcDPMSGetVersion(ClientPtr client)
 {
     /* REQUEST(xDPMSGetVersionReq); */
-    xDPMSGetVersionReply rep;
+    xDPMSGetVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = DPMSMajorVersion,
+        .minorVersion = DPMSMinorVersion
+    };
 
     REQUEST_SIZE_MATCH(xDPMSGetVersionReq);
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.majorVersion = DPMSMajorVersion;
-    rep.minorVersion = DPMSMinorVersion;
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swaps(&rep.majorVersion);
@@ -67,15 +68,15 @@ static int
 ProcDPMSCapable(ClientPtr client)
 {
     /* REQUEST(xDPMSCapableReq); */
-    xDPMSCapableReply rep;
+    xDPMSCapableReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .capable = DPMSCapableFlag
+    };
 
     REQUEST_SIZE_MATCH(xDPMSCapableReq);
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.capable = DPMSCapableFlag;
-
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
     }
@@ -87,17 +88,17 @@ static int
 ProcDPMSGetTimeouts(ClientPtr client)
 {
     /* REQUEST(xDPMSGetTimeoutsReq); */
-    xDPMSGetTimeoutsReply rep;
+    xDPMSGetTimeoutsReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .standby = DPMSStandbyTime / MILLI_PER_SECOND,
+        .suspend = DPMSSuspendTime / MILLI_PER_SECOND,
+        .off = DPMSOffTime / MILLI_PER_SECOND
+    };
 
     REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq);
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.standby = DPMSStandbyTime / MILLI_PER_SECOND;
-    rep.suspend = DPMSSuspendTime / MILLI_PER_SECOND;
-    rep.off = DPMSOffTime / MILLI_PER_SECOND;
-
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swaps(&rep.standby);
@@ -188,16 +189,16 @@ static int
 ProcDPMSInfo(ClientPtr client)
 {
     /* REQUEST(xDPMSInfoReq); */
-    xDPMSInfoReply rep;
+    xDPMSInfoReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .power_level = DPMSPowerLevel,
+        .state = DPMSEnabled
+    };
 
     REQUEST_SIZE_MATCH(xDPMSInfoReq);
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.power_level = DPMSPowerLevel;
-    rep.state = DPMSEnabled;
-
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swaps(&rep.power_level);
diff --git a/Xext/geext.c b/Xext/geext.c
index 7bdd873..d6a57d9 100644
--- a/Xext/geext.c
+++ b/Xext/geext.c
@@ -59,21 +59,21 @@ static int
 ProcGEQueryVersion(ClientPtr client)
 {
     GEClientInfoPtr pGEClient = GEGetClient(client);
-    xGEQueryVersionReply rep;
+    xGEQueryVersionReply rep = {
+        .repType = X_Reply,
+        .RepType = X_GEQueryVersion,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+
+        /* return the supported version by the server */
+        .majorVersion = SERVER_GE_MAJOR_VERSION,
+        .minorVersion = SERVER_GE_MINOR_VERSION
+    };
 
     REQUEST(xGEQueryVersionReq);
 
     REQUEST_SIZE_MATCH(xGEQueryVersionReq);
 
-    rep.repType = X_Reply;
-    rep.RepType = X_GEQueryVersion;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-
-    /* return the supported version by the server */
-    rep.majorVersion = SERVER_GE_MAJOR_VERSION;
-    rep.minorVersion = SERVER_GE_MINOR_VERSION;
-
     /* Remember version the client requested */
     pGEClient->major_version = stuff->majorVersion;
     pGEClient->minor_version = stuff->minorVersion;
diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index 98c612a..f3d9d9a 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -904,14 +904,15 @@ int
 ProcPanoramiXQueryVersion(ClientPtr client)
 {
     /* REQUEST(xPanoramiXQueryVersionReq); */
-    xPanoramiXQueryVersionReply rep;
+    xPanoramiXQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = SERVER_PANORAMIX_MAJOR_VERSION,
+        .minorVersion = SERVER_PANORAMIX_MINOR_VERSION
+    };
 
     REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.majorVersion = SERVER_PANORAMIX_MAJOR_VERSION;
-    rep.minorVersion = SERVER_PANORAMIX_MINOR_VERSION;
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -927,27 +928,28 @@ ProcPanoramiXGetState(ClientPtr client)
 {
     REQUEST(xPanoramiXGetStateReq);
     WindowPtr pWin;
-    xPanoramiXGetStateReply rep;
     int rc;
 
     REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
     rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
     if (rc != Success)
         return rc;
-
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.state = !noPanoramiXExtension;
-    rep.window = stuff->window;
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.length);
-        swapl(&rep.window);
+    else {
+        xPanoramiXGetStateReply rep = {
+            .type = X_Reply,
+            .state = !noPanoramiXExtension,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .window = stuff->window
+        };
+        if (client->swapped) {
+            swaps(&rep.sequenceNumber);
+            swapl(&rep.length);
+            swapl(&rep.window);
+        }
+        WriteToClient(client, sizeof(xPanoramiXGetStateReply), &rep);
+        return Success;
     }
-    WriteToClient(client, sizeof(xPanoramiXGetStateReply), &rep);
-    return Success;
-
 }
 
 int
@@ -955,26 +957,28 @@ ProcPanoramiXGetScreenCount(ClientPtr client)
 {
     REQUEST(xPanoramiXGetScreenCountReq);
     WindowPtr pWin;
-    xPanoramiXGetScreenCountReply rep;
     int rc;
 
     REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
     rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
     if (rc != Success)
         return rc;
-
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.ScreenCount = PanoramiXNumScreens;
-    rep.window = stuff->window;
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.length);
-        swapl(&rep.window);
+    else {
+        xPanoramiXGetScreenCountReply rep = {
+            .type = X_Reply,
+            .ScreenCount = PanoramiXNumScreens,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .window = stuff->window
+        };
+        if (client->swapped) {
+            swaps(&rep.sequenceNumber);
+            swapl(&rep.length);
+            swapl(&rep.window);
+        }
+        WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), &rep);
+        return Success;
     }
-    WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), &rep);
-    return Success;
 }
 
 int
@@ -982,7 +986,6 @@ ProcPanoramiXGetScreenSize(ClientPtr client)
 {
     REQUEST(xPanoramiXGetScreenSizeReq);
     WindowPtr pWin;
-    xPanoramiXGetScreenSizeReply rep;
     int rc;
 
     if (stuff->screen >= PanoramiXNumScreens)
@@ -992,47 +995,46 @@ ProcPanoramiXGetScreenSize(ClientPtr client)
     rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
     if (rc != Success)
         return rc;
-
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    /* screen dimensions */
-    rep.width = screenInfo.screens[stuff->screen]->width;
-    rep.height = screenInfo.screens[stuff->screen]->height;
-    rep.window = stuff->window;
-    rep.screen = stuff->screen;
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.length);
-        swapl(&rep.width);
-        swapl(&rep.height);
-        swapl(&rep.window);
-        swapl(&rep.screen);
+    else {
+        xPanoramiXGetScreenSizeReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            /* screen dimensions */
+            .width = screenInfo.screens[stuff->screen]->width,
+            .height = screenInfo.screens[stuff->screen]->height,
+            .window = stuff->window,
+            .screen = stuff->screen
+        };
+        if (client->swapped) {
+            swaps(&rep.sequenceNumber);
+            swapl(&rep.length);
+            swapl(&rep.width);
+            swapl(&rep.height);
+            swapl(&rep.window);
+            swapl(&rep.screen);
+        }
+        WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), &rep);
+        return Success;
     }
-    WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), &rep);
-    return Success;
 }
 
 int
 ProcXineramaIsActive(ClientPtr client)
 {
     /* REQUEST(xXineramaIsActiveReq); */
-    xXineramaIsActiveReply rep;
+    xXineramaIsActiveReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
 
-    REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
-
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-#if 1
-    {
         /* The following hack fools clients into thinking that Xinerama
          * is disabled even though it is not. */
-        rep.state = !noPanoramiXExtension && !PanoramiXExtensionDisabledHack;
-    }
-#else
-    rep.state = !noPanoramiXExtension;
-#endif
+        .state = !noPanoramiXExtension && !PanoramiXExtensionDisabledHack
+    };
+
+    REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
+
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -1046,14 +1048,15 @@ int
 ProcXineramaQueryScreens(ClientPtr client)
 {
     /* REQUEST(xXineramaQueryScreensReq); */
-    xXineramaQueryScreensReply rep;
+    xXineramaQueryScreensReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = bytes_to_int32(rep.number * sz_XineramaScreenInfo),
+        .number = (noPanoramiXExtension) ? 0 : PanoramiXNumScreens
+    };
 
     REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.number = (noPanoramiXExtension) ? 0 : PanoramiXNumScreens;
-    rep.length = bytes_to_int32(rep.number * sz_XineramaScreenInfo);
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c
index bdabfbf..0c64103 100644
--- a/Xext/panoramiXprocs.c
+++ b/Xext/panoramiXprocs.c
@@ -566,14 +566,18 @@ PanoramiXGetGeometry(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.root = screenInfo.screens[0]->root->drawable.id;
-    rep.depth = pDraw->depth;
-    rep.width = pDraw->width;
-    rep.height = pDraw->height;
-    rep.x = rep.y = rep.borderWidth = 0;
+    rep = (xGetGeometryReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .root = screenInfo.screens[0]->root->drawable.id,
+        .depth = pDraw->depth,
+        .width = pDraw->width,
+        .height = pDraw->height,
+        .x = 0,
+        .y = 0,
+        .borderWidth = 0
+    };
 
     if (stuff->id == rep.root) {
         xWindowRoot *root = (xWindowRoot *)
@@ -608,7 +612,13 @@ PanoramiXTranslateCoords(ClientPtr client)
     REQUEST(xTranslateCoordsReq);
     int rc;
     WindowPtr pWin, pDst;
-    xTranslateCoordsReply rep;
+    xTranslateCoordsReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .sameScreen = xTrue,
+        .child = None
+    };
 
     REQUEST_SIZE_MATCH(xTranslateCoordsReq);
     rc = dixLookupWindow(&pWin, stuff->srcWid, client, DixReadAccess);
@@ -617,11 +627,6 @@ PanoramiXTranslateCoords(ClientPtr client)
     rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixReadAccess);
     if (rc != Success)
         return rc;
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.sameScreen = xTrue;
-    rep.child = None;
 
     if ((pWin == screenInfo.screens[0]->root) ||
         (pWin->drawable.id == screenInfo.screens[0]->screensaver.wid)) {
@@ -1886,7 +1891,10 @@ PanoramiXGetImage(ClientPtr client)
     DrawablePtr drawables[MAXSCREENS];
     DrawablePtr pDraw;
     PanoramiXRes *draw;
-    xGetImageReply xgi;
+    xGetImageReply xgi = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence
+    };
     Bool isRoot;
     char *pBuf;
     int i, x, y, w, h, format, rc;
@@ -1955,8 +1963,6 @@ PanoramiXGetImage(ClientPtr client)
     }
 
     xgi.visual = wVisual(((WindowPtr) pDraw));
-    xgi.type = X_Reply;
-    xgi.sequenceNumber = client->sequence;
     xgi.depth = pDraw->depth;
     if (format == ZPixmap) {
         widthBytesLine = PixmapBytePad(w, pDraw->depth);
diff --git a/Xext/saver.c b/Xext/saver.c
index 60c02ff..23f7595 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -634,14 +634,16 @@ ScreenSaverHandle(ScreenPtr pScreen, int xstate, Bool force)
 static int
 ProcScreenSaverQueryVersion(ClientPtr client)
 {
-    xScreenSaverQueryVersionReply rep;
+    xScreenSaverQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = SERVER_SAVER_MAJOR_VERSION,
+        .minorVersion = SERVER_SAVER_MINOR_VERSION
+    };
 
     REQUEST_SIZE_MATCH(xScreenSaverQueryVersionReq);
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.majorVersion = SERVER_SAVER_MAJOR_VERSION;
-    rep.minorVersion = SERVER_SAVER_MINOR_VERSION;
+
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -654,7 +656,11 @@ static int
 ProcScreenSaverQueryInfo(ClientPtr client)
 {
     REQUEST(xScreenSaverQueryInfoReq);
-    xScreenSaverQueryInfoReply rep;
+    xScreenSaverQueryInfoReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
     int rc;
     ScreenSaverStuffPtr pSaver;
     DrawablePtr pDraw;
@@ -677,9 +683,6 @@ ProcScreenSaverQueryInfo(ClientPtr client)
     UpdateCurrentTime();
     lastInput = GetTimeInMillis() - lastDeviceEventTime[XIAllDevices].milliseconds;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
     rep.window = pSaver->wid;
     if (screenIsSaved != SCREEN_SAVER_OFF) {
         rep.state = ScreenSaverOn;
diff --git a/Xext/security.c b/Xext/security.c
index fd63571..293c113 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -338,14 +338,16 @@ static int
 ProcSecurityQueryVersion(ClientPtr client)
 {
     /* REQUEST(xSecurityQueryVersionReq); */
-    xSecurityQueryVersionReply rep;
+    xSecurityQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = SERVER_SECURITY_MAJOR_VERSION,
+        .minorVersion = SERVER_SECURITY_MINOR_VERSION
+    };
 
     REQUEST_SIZE_MATCH(xSecurityQueryVersionReq);
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.majorVersion = SERVER_SECURITY_MAJOR_VERSION;
-    rep.minorVersion = SERVER_SECURITY_MINOR_VERSION;
+
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swaps(&rep.majorVersion);
@@ -396,7 +398,6 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
     SecurityAuthorizationPtr pAuth = NULL;      /* auth we are creating */
     int err;                    /* error to return from this function */
     XID authId;                 /* authorization ID assigned by os layer */
-    xSecurityGenerateAuthorizationReply rep;    /* reply struct */
     unsigned int trustLevel;    /* trust level of new auth */
     XID group;                  /* group of new auth */
     CARD32 timeout;             /* timeout of new auth */
@@ -526,23 +527,27 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
         SecurityStartAuthorizationTimer(pAuth);
 
     /* tell client the auth id and data */
+    {
+        xSecurityGenerateAuthorizationReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = bytes_to_int32(authdata_len),
+            .authId = authId,
+            .dataLength = authdata_len
+        };
+
+        if (client->swapped) {
+            swapl(&rep.length);
+            swaps(&rep.sequenceNumber);
+            swapl(&rep.authId);
+            swaps(&rep.dataLength);
+        }
 
-    rep.type = X_Reply;
-    rep.length = bytes_to_int32(authdata_len);
-    rep.sequenceNumber = client->sequence;
-    rep.authId = authId;
-    rep.dataLength = authdata_len;
-
-    if (client->swapped) {
-        swapl(&rep.length);
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.authId);
-        swaps(&rep.dataLength);
+        WriteToClient(client, SIZEOF(xSecurityGenerateAuthorizationReply),
+                      &rep);
+        WriteToClient(client, authdata_len, pAuthdata);
     }
 
-    WriteToClient(client, SIZEOF(xSecurityGenerateAuthorizationReply), &rep);
-    WriteToClient(client, authdata_len, pAuthdata);
-
     SecurityAudit
         ("client %d generated authorization %d trust %d timeout %d group %d events %d\n",
          client->index, pAuth->id, pAuth->trustLevel, pAuth->timeout,
diff --git a/Xext/shape.c b/Xext/shape.c
index 7724e7b..f742387 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);
@@ -622,7 +623,11 @@ ProcShapeQueryExtents(ClientPtr client)
 {
     REQUEST(xShapeQueryExtentsReq);
     WindowPtr pWin;
-    xShapeQueryExtentsReply rep;
+    xShapeQueryExtentsReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
     BoxRec extents, *pExtents;
     int rc;
     RegionPtr region;
@@ -631,10 +636,6 @@ 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);
     if ((region = wBoundingShape(pWin))) {
@@ -901,7 +902,6 @@ ProcShapeInputSelected(ClientPtr client)
     WindowPtr pWin;
     ShapeEventPtr pShapeEvent, *pHead;
     int enabled, rc;
-    xShapeInputSelectedReply rep;
 
     REQUEST_SIZE_MATCH(xShapeInputSelectedReq);
     rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
@@ -920,15 +920,19 @@ ProcShapeInputSelected(ClientPtr client)
             }
         }
     }
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.enabled = enabled;
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.length);
+    {
+        xShapeInputSelectedReply rep = {
+            .type = X_Reply,
+            .enabled = enabled,
+            .sequenceNumber = client->sequence,
+            .length = 0
+        };
+        if (client->swapped) {
+            swaps(&rep.sequenceNumber);
+            swapl(&rep.length);
+        }
+        WriteToClient(client, sizeof(xShapeInputSelectedReply), &rep);
     }
-    WriteToClient(client, sizeof(xShapeInputSelectedReply), &rep);
     return Success;
 }
 
@@ -937,7 +941,6 @@ ProcShapeGetRectangles(ClientPtr client)
 {
     REQUEST(xShapeGetRectanglesReq);
     WindowPtr pWin;
-    xShapeGetRectanglesReply rep;
     xRectangle *rects;
     int nrects, i, rc;
     RegionPtr region;
@@ -1001,18 +1004,22 @@ 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;
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.length);
-        swapl(&rep.nrects);
-        SwapShorts((short *) rects, (unsigned long) nrects * 4);
+    {
+        xShapeGetRectanglesReply rep = {
+            .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);
+            swapl(&rep.nrects);
+            SwapShorts((short *) rects, (unsigned long) nrects * 4);
+        }
+        WriteToClient(client, sizeof(rep), &rep);
     }
-    WriteToClient(client, sizeof(rep), &rep);
     WriteToClient(client, nrects * sizeof(xRectangle), rects);
     free(rects);
     return Success;
diff --git a/Xext/shm.c b/Xext/shm.c
index 1cdb401..540ae30 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -285,19 +285,20 @@ ShmRegisterFbFuncs(ScreenPtr pScreen)
 static int
 ProcShmQueryVersion(ClientPtr client)
 {
-    xShmQueryVersionReply rep;
+    xShmQueryVersionReply rep = {
+        .type = X_Reply,
+        .sharedPixmaps = sharedPixmaps,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = SERVER_SHM_MAJOR_VERSION,
+        .minorVersion = SERVER_SHM_MINOR_VERSION,
+        .uid = geteuid(),
+        .gid = getegid(),
+        .pixmapFormat = sharedPixmaps ? ZPixmap : 0
+    };
 
     REQUEST_SIZE_MATCH(xShmQueryVersionReq);
-    memset(&rep, 0, sizeof(xShmQueryVersionReply));
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.sharedPixmaps = sharedPixmaps;
-    rep.pixmapFormat = sharedPixmaps ? ZPixmap : 0;
-    rep.majorVersion = SERVER_SHM_MAJOR_VERSION;
-    rep.minorVersion = SERVER_SHM_MINOR_VERSION;
-    rep.uid = geteuid();
-    rep.gid = getegid();
+
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -614,7 +615,11 @@ ProcShmGetImage(ClientPtr client)
     DrawablePtr pDraw;
     long lenPer = 0, length;
     Mask plane = 0;
-    xShmGetImageReply xgi;
+    xShmGetImageReply xgi = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
     ShmDescPtr shmdesc;
     int rc;
 
@@ -655,9 +660,6 @@ ProcShmGetImage(ClientPtr client)
             return BadMatch;
         xgi.visual = None;
     }
-    xgi.type = X_Reply;
-    xgi.length = 0;
-    xgi.sequenceNumber = client->sequence;
     xgi.depth = pDraw->depth;
     if (stuff->format == ZPixmap) {
         length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height;
@@ -756,7 +758,11 @@ ProcPanoramiXShmGetImage(ClientPtr client)
     PanoramiXRes *draw;
     DrawablePtr *drawables;
     DrawablePtr pDraw;
-    xShmGetImageReply xgi;
+    xShmGetImageReply xgi = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
     ShmDescPtr shmdesc;
     int i, x, y, w, h, format, rc;
     Mask plane = 0, planemask;
@@ -831,9 +837,6 @@ ProcPanoramiXShmGetImage(ClientPtr client)
     }
 
     xgi.visual = wVisual(((WindowPtr) pDraw));
-    xgi.type = X_Reply;
-    xgi.length = 0;
-    xgi.sequenceNumber = client->sequence;
     xgi.depth = pDraw->depth;
 
     if (format == ZPixmap) {
diff --git a/Xext/sync.c b/Xext/sync.c
index 45aeefc..1ebe870 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -1184,17 +1184,16 @@ FreeAlarmClient(void *value, XID id)
 static int
 ProcSyncInitialize(ClientPtr client)
 {
-    xSyncInitializeReply rep;
+    xSyncInitializeReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = SERVER_SYNC_MAJOR_VERSION,
+        .minorVersion = SERVER_SYNC_MINOR_VERSION,
+    };
 
     REQUEST_SIZE_MATCH(xSyncInitializeReq);
 
-    memset(&rep, 0, sizeof(xSyncInitializeReply));
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.majorVersion = SERVER_SYNC_MAJOR_VERSION;
-    rep.minorVersion = SERVER_SYNC_MINOR_VERSION;
-    rep.length = 0;
-
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
     }
@@ -1208,17 +1207,17 @@ ProcSyncInitialize(ClientPtr client)
 static int
 ProcSyncListSystemCounters(ClientPtr client)
 {
-    xSyncListSystemCountersReply rep;
+    xSyncListSystemCountersReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .nCounters = 0,
+    };
     SysCounterInfo *psci;
     int len = 0;
     xSyncSystemCounter *list = NULL, *walklist = NULL;
 
     REQUEST_SIZE_MATCH(xSyncListSystemCountersReq);
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.nCounters = 0;
-
     xorg_list_for_each_entry(psci, &SysCounterList, entry) {
         /* pad to 4 byte boundary */
         len += pad_to_int32(sz_xSyncSystemCounter + strlen(psci->name));
@@ -1313,7 +1312,6 @@ static int
 ProcSyncGetPriority(ClientPtr client)
 {
     REQUEST(xSyncGetPriorityReq);
-    xSyncGetPriorityReply rep;
     ClientPtr priorityclient;
     int rc;
 
@@ -1328,17 +1326,21 @@ ProcSyncGetPriority(ClientPtr client)
             return rc;
     }
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.priority = priorityclient->priority;
+    {
+        xSyncGetPriorityReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .priority = priorityclient->priority
+        };
 
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.priority);
-    }
+        if (client->swapped) {
+            swaps(&rep.sequenceNumber);
+            swapl(&rep.priority);
+        }
 
-    WriteToClient(client, sizeof(xSyncGetPriorityReply), &rep);
+        WriteToClient(client, sizeof(xSyncGetPriorityReply), &rep);
+    }
 
     return Success;
 }
@@ -1594,7 +1596,6 @@ static int
 ProcSyncQueryCounter(ClientPtr client)
 {
     REQUEST(xSyncQueryCounterReq);
-    xSyncQueryCounterReply rep;
     SyncCounter *pCounter;
     int rc;
 
@@ -1605,10 +1606,6 @@ ProcSyncQueryCounter(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-
     /* if system counter, ask it what the current value is */
 
     if (IsSystemCounter(pCounter)) {
@@ -1616,15 +1613,24 @@ ProcSyncQueryCounter(ClientPtr client)
                                                   &pCounter->value);
     }
 
-    rep.value_hi = XSyncValueHigh32(pCounter->value);
-    rep.value_lo = XSyncValueLow32(pCounter->value);
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.length);
-        swapl(&rep.value_hi);
-        swapl(&rep.value_lo);
+    {
+        xSyncQueryCounterReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .value_hi = XSyncValueHigh32(pCounter->value),
+            .value_lo = XSyncValueLow32(pCounter->value)
+        };
+
+        if (client->swapped) {
+            swaps(&rep.sequenceNumber);
+            swapl(&rep.length);
+            swapl(&rep.value_hi);
+            swapl(&rep.value_lo);
+        }
+
+        WriteToClient(client, sizeof(xSyncQueryCounterReply), &rep);
     }
-    WriteToClient(client, sizeof(xSyncQueryCounterReply), &rep);
     return Success;
 }
 
@@ -1760,8 +1766,6 @@ ProcSyncQueryAlarm(ClientPtr client)
 {
     REQUEST(xSyncQueryAlarmReq);
     SyncAlarm *pAlarm;
-    xSyncQueryAlarmReply rep;
-    SyncTrigger *pTrigger;
     int rc;
 
     REQUEST_SIZE_MATCH(xSyncQueryAlarmReq);
@@ -1770,47 +1774,50 @@ ProcSyncQueryAlarm(ClientPtr client)
                                  client, DixReadAccess);
     if (rc != Success)
         return rc;
-
-    rep.type = X_Reply;
-    rep.length =
-        bytes_to_int32(sizeof(xSyncQueryAlarmReply) - sizeof(xGenericReply));
-    rep.sequenceNumber = client->sequence;
-
-    pTrigger = &pAlarm->trigger;
-    rep.counter = (pTrigger->pSync) ? pTrigger->pSync->id : None;
-
-#if 0                           /* XXX unclear what to do, depends on whether relative value-types
-                                 * are "consumed" immediately and are considered absolute from then
-                                 * on.
-                                 */
-    rep.value_type = pTrigger->value_type;
-    rep.wait_value_hi = XSyncValueHigh32(pTrigger->wait_value);
-    rep.wait_value_lo = XSyncValueLow32(pTrigger->wait_value);
+    else {
+        SyncTrigger *pTrigger = &pAlarm->trigger;
+        xSyncQueryAlarmReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length =
+                bytes_to_int32(sizeof(xSyncQueryAlarmReply) -
+                               sizeof(xGenericReply)),
+            .counter = (pTrigger->pSync) ? pTrigger->pSync->id : None,
+
+#if 0       /* XXX unclear what to do, depends on whether relative value-types
+             * are "consumed" immediately and are considered absolute from then
+             * on.
+             */
+            .value_type = pTrigger->value_type,
+            .wait_value_hi = XSyncValueHigh32(pTrigger->wait_value),
+            .wait_value_lo = XSyncValueLow32(pTrigger->wait_value),
 #else
-    rep.value_type = XSyncAbsolute;
-    rep.wait_value_hi = XSyncValueHigh32(pTrigger->test_value);
-    rep.wait_value_lo = XSyncValueLow32(pTrigger->test_value);
+            .value_type = XSyncAbsolute,
+            .wait_value_hi = XSyncValueHigh32(pTrigger->test_value),
+            .wait_value_lo = XSyncValueLow32(pTrigger->test_value),
 #endif
 
-    rep.test_type = pTrigger->test_type;
-    rep.delta_hi = XSyncValueHigh32(pAlarm->delta);
-    rep.delta_lo = XSyncValueLow32(pAlarm->delta);
-    rep.events = pAlarm->events;
-    rep.state = pAlarm->state;
+            .test_type = pTrigger->test_type,
+            .delta_hi = XSyncValueHigh32(pAlarm->delta),
+            .delta_lo = XSyncValueLow32(pAlarm->delta),
+            .events = pAlarm->events,
+            .state = pAlarm->state
+        };
 
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.length);
-        swapl(&rep.counter);
-        swapl(&rep.wait_value_hi);
-        swapl(&rep.wait_value_lo);
-        swapl(&rep.test_type);
-        swapl(&rep.delta_hi);
-        swapl(&rep.delta_lo);
-    }
+        if (client->swapped) {
+            swaps(&rep.sequenceNumber);
+            swapl(&rep.length);
+            swapl(&rep.counter);
+            swapl(&rep.wait_value_hi);
+            swapl(&rep.wait_value_lo);
+            swapl(&rep.test_type);
+            swapl(&rep.delta_hi);
+            swapl(&rep.delta_lo);
+        }
 
-    WriteToClient(client, sizeof(xSyncQueryAlarmReply), &rep);
-    return Success;
+        WriteToClient(client, sizeof(xSyncQueryAlarmReply), &rep);
+        return Success;
+    }
 }
 
 static int
@@ -1944,7 +1951,6 @@ static int
 ProcSyncQueryFence(ClientPtr client)
 {
     REQUEST(xSyncQueryFenceReq);
-    xSyncQueryFenceReply rep;
     SyncFence *pFence;
     int rc;
 
@@ -1954,20 +1960,22 @@ ProcSyncQueryFence(ClientPtr client)
                                  RTFence, client, DixReadAccess);
     if (rc != Success)
         return rc;
+    else {
+        xSyncQueryFenceReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .triggered = pFence->funcs.CheckTriggered(pFence)
+        };
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-
-    rep.triggered = pFence->funcs.CheckTriggered(pFence);
+        if (client->swapped) {
+            swaps(&rep.sequenceNumber);
+            swapl(&rep.length);
+        }
 
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.length);
+        WriteToClient(client, sizeof(xSyncQueryFenceReply), &rep);
+        return client->noClientException;
     }
-
-    WriteToClient(client, sizeof(xSyncQueryFenceReply), &rep);
-    return client->noClientException;
 }
 
 static int
diff --git a/Xext/xcmisc.c b/Xext/xcmisc.c
index 943b424..f013f12 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);
@@ -65,22 +67,25 @@ ProcXCMiscGetVersion(ClientPtr client)
 static int
 ProcXCMiscGetXIDRange(ClientPtr client)
 {
-    xXCMiscGetXIDRangeReply rep;
     XID min_id, max_id;
 
     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;
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.start_id);
-        swapl(&rep.count);
+    {
+        xXCMiscGetXIDRangeReply rep = {
+            .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);
+            swapl(&rep.count);
+        }
+        WriteToClient(client, sizeof(xXCMiscGetXIDRangeReply), &rep);
     }
-    WriteToClient(client, sizeof(xXCMiscGetXIDRangeReply), &rep);
     return Success;
 }
 
@@ -88,9 +93,7 @@ static int
 ProcXCMiscGetXIDList(ClientPtr client)
 {
     REQUEST(xXCMiscGetXIDListReq);
-    xXCMiscGetXIDListReply rep;
     XID *pids;
-    unsigned int count;
 
     REQUEST_SIZE_MATCH(xXCMiscGetXIDListReq);
 
@@ -101,23 +104,27 @@ ProcXCMiscGetXIDList(ClientPtr client)
     if (!pids) {
         return BadAlloc;
     }
-    count = GetXIDList(client, stuff->count, pids);
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = count;
-    rep.count = count;
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.length);
-        swapl(&rep.count);
-    }
-    WriteToClient(client, sizeof(xXCMiscGetXIDListReply), &rep);
-    if (count) {
-        client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
-        WriteSwappedDataToClient(client, count * sizeof(XID), pids);
+    else {
+        unsigned int count = GetXIDList(client, stuff->count, pids);
+        xXCMiscGetXIDListReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = count,
+            .count = count
+        };
+        if (client->swapped) {
+            swaps(&rep.sequenceNumber);
+            swapl(&rep.length);
+            swapl(&rep.count);
+        }
+        WriteToClient(client, sizeof(xXCMiscGetXIDListReply), &rep);
+        if (count) {
+            client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
+            WriteSwappedDataToClient(client, count * sizeof(XID), pids);
+        }
+        free(pids);
+        return Success;
     }
-    free(pids);
-    return Success;
 }
 
 static int
diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c
index 3a1e1b2..ed73e82 100644
--- a/Xext/xf86bigfont.c
+++ b/Xext/xf86bigfont.c
@@ -274,28 +274,25 @@ XF86BigfontResetProc(ExtensionEntry * extEntry)
 static int
 ProcXF86BigfontQueryVersion(ClientPtr client)
 {
-    xXF86BigfontQueryVersionReply reply;
-
-    REQUEST_SIZE_MATCH(xXF86BigfontQueryVersionReq);
-    reply.type = X_Reply;
-    reply.length = 0;
-    reply.sequenceNumber = client->sequence;
-    reply.majorVersion = SERVER_XF86BIGFONT_MAJOR_VERSION;
-    reply.minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION;
-    reply.uid = geteuid();
-    reply.gid = getegid();
+    xXF86BigfontQueryVersionReply reply = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = SERVER_XF86BIGFONT_MAJOR_VERSION,
+        .minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION,
+        .uid = geteuid(),
+        .gid = getegid(),
 #ifdef HAS_SHM
-    reply.signature = signature;
+        .signature = signature,
+        .capabilities = (LocalClient(client) && !client->swapped)
+                         ? XF86Bigfont_CAP_LocalShm : 0
 #else
-    reply.signature = 0;        /* This is redundant. Avoids uninitialized memory. */
+        .signature = 0,
+        .capabilities = 0
 #endif
-    reply.capabilities =
-#ifdef HAS_SHM
-        (LocalClient(client) && !client->swapped ? XF86Bigfont_CAP_LocalShm : 0)
-#else
-        0
-#endif
-        ;                       /* may add more bits here in future versions */
+    };
+
+    REQUEST_SIZE_MATCH(xXF86BigfontQueryVersionReq);
     if (client->swapped) {
         char tmp;
 
@@ -554,7 +551,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
                ? nUniqCharInfos * sizeof(xCharInfo)
                + (nCharInfos + 1) / 2 * 2 * sizeof(CARD16)
                : 0);
-        xXF86BigfontQueryFontReply *reply = malloc(rlength);
+        xXF86BigfontQueryFontReply *reply = calloc(1, rlength);
         char *p;
 
         if (!reply) {
diff --git a/Xext/xres.c b/Xext/xres.c
index d207dce..f0d89a8 100644
--- a/Xext/xres.c
+++ b/Xext/xres.c
@@ -194,15 +194,16 @@ static int
 ProcXResQueryVersion(ClientPtr client)
 {
     REQUEST(xXResQueryVersionReq);
-    xXResQueryVersionReply rep;
+    xXResQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .server_major = SERVER_XRES_MAJOR_VERSION,
+        .server_minor = SERVER_XRES_MINOR_VERSION
+    };
 
     REQUEST_SIZE_MATCH(xXResQueryVersionReq);
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.server_major = SERVER_XRES_MAJOR_VERSION;
-    rep.server_minor = SERVER_XRES_MINOR_VERSION;
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -217,7 +218,6 @@ static int
 ProcXResQueryClients(ClientPtr client)
 {
     /* REQUEST(xXResQueryClientsReq); */
-    xXResQueryClientsReply rep;
     int *current_clients;
     int i, num_clients;
 
@@ -233,16 +233,20 @@ ProcXResQueryClients(ClientPtr client)
         }
     }
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.num_clients = num_clients;
-    rep.length = bytes_to_int32(rep.num_clients * sz_xXResClient);
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.length);
-        swapl(&rep.num_clients);
+    {
+        xXResQueryClientsReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = bytes_to_int32(num_clients * sz_xXResClient),
+            .num_clients = num_clients
+        };
+        if (client->swapped) {
+            swaps(&rep.sequenceNumber);
+            swapl(&rep.length);
+            swapl(&rep.num_clients);
+        }
+        WriteToClient(client, sizeof(xXResQueryClientsReply), &rep);
     }
-    WriteToClient(client, sizeof(xXResQueryClientsReply), &rep);
 
     if (num_clients) {
         xXResClient scratch;
@@ -276,7 +280,6 @@ static int
 ProcXResQueryClientResources(ClientPtr client)
 {
     REQUEST(xXResQueryClientResourcesReq);
-    xXResQueryClientResourcesReply rep;
     int i, clientID, num_types;
     int *counts;
 
@@ -300,17 +303,22 @@ ProcXResQueryClientResources(ClientPtr client)
             num_types++;
     }
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.num_types = num_types;
-    rep.length = bytes_to_int32(rep.num_types * sz_xXResType);
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.length);
-        swapl(&rep.num_types);
-    }
+    {
+        xXResQueryClientResourcesReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = bytes_to_int32(num_types * sz_xXResType),
+            .num_types = num_types
+        };
 
-    WriteToClient(client, sizeof(xXResQueryClientResourcesReply), &rep);
+        if (client->swapped) {
+            swaps(&rep.sequenceNumber);
+            swapl(&rep.length);
+            swapl(&rep.num_types);
+        }
+
+        WriteToClient(client, sizeof(xXResQueryClientResourcesReply), &rep);
+    }
 
     if (num_types) {
         xXResType scratch;
@@ -426,7 +434,6 @@ static int
 ProcXResQueryClientPixmapBytes(ClientPtr client)
 {
     REQUEST(xXResQueryClientPixmapBytesReq);
-    xXResQueryClientPixmapBytesReply rep;
     int clientID;
     unsigned long bytes;
 
@@ -470,22 +477,26 @@ ProcXResQueryClientPixmapBytes(ClientPtr client)
                               (pointer)(&bytes));
 #endif
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.bytes = bytes;
+    {
+        xXResQueryClientPixmapBytesReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .bytes = bytes,
 #ifdef _XSERVER64
-    rep.bytes_overflow = bytes >> 32;
+            .bytes_overflow = bytes >> 32
 #else
-    rep.bytes_overflow = 0;
+            .bytes_overflow = 0
 #endif
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.length);
-        swapl(&rep.bytes);
-        swapl(&rep.bytes_overflow);
+        };
+        if (client->swapped) {
+            swaps(&rep.sequenceNumber);
+            swapl(&rep.length);
+            swapl(&rep.bytes);
+            swapl(&rep.bytes_overflow);
+        }
+        WriteToClient(client, sizeof(xXResQueryClientPixmapBytesReply), &rep);
     }
-    WriteToClient(client, sizeof(xXResQueryClientPixmapBytesReply), &rep);
 
     return Success;
 }
@@ -650,7 +661,6 @@ ProcXResQueryClientIds (ClientPtr client)
 {
     REQUEST(xXResQueryClientIdsReq);
 
-    xXResQueryClientIdsReply  rep;
     xXResClientIdSpec        *specs = (void*) ((char*) stuff + sizeof(*stuff));
     int                       rc;
     ConstructClientIdCtx      ctx;
@@ -662,14 +672,14 @@ ProcXResQueryClientIds (ClientPtr client)
                        stuff->numSpecs * sizeof(specs[0]));
 
     rc = ConstructClientIds(client, stuff->numSpecs, specs, &ctx);
-
     if (rc == Success) {
-        rep.type = X_Reply;
-        rep.sequenceNumber = client->sequence;
-
+        xXResQueryClientIdsReply  rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = bytes_to_int32(ctx.resultBytes),
+            .numIds = ctx.numIds
+        };
         assert((ctx.resultBytes & 3) == 0);
-        rep.length = bytes_to_int32(ctx.resultBytes);
-        rep.numIds = ctx.numIds;
 
         if (client->swapped) {
             swaps (&rep.sequenceNumber);
@@ -1028,7 +1038,6 @@ ProcXResQueryResourceBytes (ClientPtr client)
 {
     REQUEST(xXResQueryResourceBytesReq);
 
-    xXResQueryResourceBytesReply rep;
     int                          rc;
     ConstructResourceBytesCtx    ctx;
 
@@ -1046,10 +1055,12 @@ ProcXResQueryResourceBytes (ClientPtr client)
     rc = ConstructResourceBytes(stuff->client, &ctx);
 
     if (rc == Success) {
-        rep.type = X_Reply;
-        rep.sequenceNumber = client->sequence;
-        rep.numSizes = ctx.numSizes;
-        rep.length = bytes_to_int32(ctx.resultBytes);
+        xXResQueryResourceBytesReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = bytes_to_int32(ctx.resultBytes),
+            .numSizes = ctx.numSizes
+        };
 
         if (client->swapped) {
             swaps (&rep.sequenceNumber);
diff --git a/Xext/xselinux_ext.c b/Xext/xselinux_ext.c
index 8817591..749696a 100644
--- a/Xext/xselinux_ext.c
+++ b/Xext/xselinux_ext.c
@@ -63,13 +63,13 @@ SELinuxCopyContext(char *ptr, unsigned len)
 static int
 ProcSELinuxQueryVersion(ClientPtr client)
 {
-    SELinuxQueryVersionReply rep;
-
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.server_major = SELINUX_MAJOR_VERSION;
-    rep.server_minor = SELINUX_MINOR_VERSION;
+    SELinuxQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .server_major = SELINUX_MAJOR_VERSION,
+        .server_minor = SELINUX_MINOR_VERSION
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -83,7 +83,6 @@ ProcSELinuxQueryVersion(ClientPtr client)
 static int
 SELinuxSendContextReply(ClientPtr client, security_id_t sid)
 {
-    SELinuxGetContextReply rep;
     security_context_t ctx = NULL;
     int len = 0;
 
@@ -93,18 +92,22 @@ SELinuxSendContextReply(ClientPtr client, security_id_t sid)
         len = strlen(ctx) + 1;
     }
 
-    rep.type = X_Reply;
-    rep.length = bytes_to_int32(len);
-    rep.sequenceNumber = client->sequence;
-    rep.context_len = len;
+    {
+        SELinuxGetContextReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = bytes_to_int32(len),
+            .context_len = len
+        };
+
+        if (client->swapped) {
+            swapl(&rep.length);
+            swaps(&rep.sequenceNumber);
+            swapl(&rep.context_len);
+        }
 
-    if (client->swapped) {
-        swapl(&rep.length);
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.context_len);
+        WriteToClient(client, sizeof(SELinuxGetContextReply), &rep);
     }
-
-    WriteToClient(client, sizeof(SELinuxGetContextReply), &rep);
     WriteToClient(client, len, ctx);
     freecon(ctx);
     return Success;
@@ -339,7 +342,6 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
                          int size, int count)
 {
     int rc, k, pos = 0;
-    SELinuxListItemsReply rep;
     CARD32 *buf;
 
     buf = calloc(size, sizeof(CARD32));
@@ -372,18 +374,22 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
     }
 
     /* Send reply to client */
-    rep.type = X_Reply;
-    rep.length = size;
-    rep.sequenceNumber = client->sequence;
-    rep.count = count;
+    {
+        SELinuxListItemsReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = size,
+            .count = count
+        };
+
+        if (client->swapped) {
+            swapl(&rep.length);
+            swaps(&rep.sequenceNumber);
+            swapl(&rep.count);
+        }
 
-    if (client->swapped) {
-        swapl(&rep.length);
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.count);
+        WriteToClient(client, sizeof(SELinuxListItemsReply), &rep);
     }
-
-    WriteToClient(client, sizeof(SELinuxListItemsReply), &rep);
     WriteToClient(client, size * 4, buf);
 
     /* Free stuff and return */
diff --git a/Xext/xtest.c b/Xext/xtest.c
index 6112c0b..44f1c8a 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -88,14 +88,16 @@ static int XTestSwapFakeInput(ClientPtr /* client */ ,
 static int
 ProcXTestGetVersion(ClientPtr client)
 {
-    xXTestGetVersionReply rep;
+    xXTestGetVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = XTestMajorVersion,
+        .minorVersion = XTestMinorVersion
+    };
 
     REQUEST_SIZE_MATCH(xXTestGetVersionReq);
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.majorVersion = XTestMajorVersion;
-    rep.minorVersion = XTestMinorVersion;
+
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swaps(&rep.minorVersion);
@@ -108,7 +110,6 @@ static int
 ProcXTestCompareCursor(ClientPtr client)
 {
     REQUEST(xXTestCompareCursorReq);
-    xXTestCompareCursorReply rep;
     WindowPtr pWin;
     CursorPtr pCursor;
     int rc;
@@ -134,14 +135,18 @@ ProcXTestCompareCursor(ClientPtr client)
             return rc;
         }
     }
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.same = (wCursor(pWin) == pCursor);
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
+    {
+        xXTestCompareCursorReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .same = (wCursor(pWin) == pCursor)
+        };
+        if (client->swapped) {
+            swaps(&rep.sequenceNumber);
+        }
+        WriteToClient(client, sizeof(xXTestCompareCursorReply), &rep);
     }
-    WriteToClient(client, sizeof(xXTestCompareCursorReply), &rep);
     return Success;
 }
 
diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c
index 8730267..2f5dce3 100644
--- a/Xext/xvdisp.c
+++ b/Xext/xvdisp.c
@@ -302,17 +302,17 @@ SWriteListImageFormatsReply(ClientPtr client, xvListImageFormatsReply * rep)
 static int
 ProcXvQueryExtension(ClientPtr client)
 {
-    xvQueryExtensionReply rep;
+    xvQueryExtensionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .version = XvVersion,
+        .revision = XvRevision
+    };
 
     /* REQUEST(xvQueryExtensionReq); */
     REQUEST_SIZE_MATCH(xvQueryExtensionReq);
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.version = XvVersion;
-    rep.revision = XvRevision;
-
     _WriteQueryExtensionReply(client, &rep);
 
     return Success;
@@ -323,7 +323,11 @@ ProcXvQueryAdaptors(ClientPtr client)
 {
     xvFormat format;
     xvAdaptorInfo ainfo;
-    xvQueryAdaptorsReply rep;
+    xvQueryAdaptorsReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
     int totalSize, na, nf, rc;
     int nameSize;
     XvAdaptorPtr pa;
@@ -343,10 +347,7 @@ ProcXvQueryAdaptors(ClientPtr client)
     pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
                                           XvGetScreenKey());
     if (!pxvs) {
-        rep.type = X_Reply;
-        rep.sequenceNumber = client->sequence;
         rep.num_adaptors = 0;
-        rep.length = 0;
 
         _WriteQueryAdaptorsReply(client, &rep);
 
@@ -354,9 +355,6 @@ ProcXvQueryAdaptors(ClientPtr client)
     }
 
     (*pxvs->ddQueryAdaptors) (pScreen, &pxvs->pAdaptors, &pxvs->nAdaptors);
-
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
     rep.num_adaptors = pxvs->nAdaptors;
 
     /* CALCULATE THE TOTAL SIZE OF THE REPLY IN BYTES */
@@ -411,7 +409,6 @@ static int
 ProcXvQueryEncodings(ClientPtr client)
 {
     xvEncodingInfo einfo;
-    xvQueryEncodingsReply rep;
     int totalSize;
     int nameSize;
     XvPortPtr pPort;
@@ -429,9 +426,6 @@ ProcXvQueryEncodings(ClientPtr client)
         return status;
     }
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.num_encodings = pPort->pAdaptor->nEncodings;
 
     /* FOR EACH ENCODING ADD UP THE BYTES FOR ENCODING NAMES */
 
@@ -443,9 +437,16 @@ ProcXvQueryEncodings(ClientPtr client)
         pe++;
     }
 
-    rep.length = bytes_to_int32(totalSize);
+    {
+        xvQueryEncodingsReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = bytes_to_int32(totalSize),
+            .num_encodings = pPort->pAdaptor->nEncodings
+        };
 
-    _WriteQueryEncodingsReply(client, &rep);
+        _WriteQueryEncodingsReply(client, &rep);
+    }
 
     ne = pPort->pAdaptor->nEncodings;
     pe = pPort->pAdaptor->pEncodings;
@@ -645,7 +646,6 @@ ProcXvGrabPort(ClientPtr client)
 {
     int result, status;
     XvPortPtr pPort;
-    xvGrabPortReply rep;
 
     REQUEST(xvGrabPortReq);
     REQUEST_SIZE_MATCH(xvGrabPortReq);
@@ -662,15 +662,18 @@ ProcXvGrabPort(ClientPtr client)
     if (status != Success) {
         return status;
     }
+    else {
+        xvGrabPortReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .result = result
+        };
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.result = result;
-
-    _WriteGrabPortReply(client, &rep);
+        _WriteGrabPortReply(client, &rep);
 
-    return Success;
+        return Success;
+    }
 }
 
 static int
@@ -754,7 +757,6 @@ ProcXvGetPortAttribute(ClientPtr client)
     INT32 value;
     int status;
     XvPortPtr pPort;
-    xvGetPortAttributeReply rep;
 
     REQUEST(xvGetPortAttributeReq);
     REQUEST_SIZE_MATCH(xvGetPortAttributeReq);
@@ -776,15 +778,18 @@ ProcXvGetPortAttribute(ClientPtr client)
         client->errorValue = stuff->attribute;
         return status;
     }
+    else {
+        xvGetPortAttributeReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .value = value
+        };
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.value = value;
+        _WriteGetPortAttributeReply(client, &rep);
 
-    _WriteGetPortAttributeReply(client, &rep);
-
-    return Success;
+        return Success;
+    }
 }
 
 static int
@@ -793,7 +798,6 @@ ProcXvQueryBestSize(ClientPtr client)
     int status;
     unsigned int actual_width, actual_height;
     XvPortPtr pPort;
-    xvQueryBestSizeReply rep;
 
     REQUEST(xvQueryBestSizeReq);
     REQUEST_SIZE_MATCH(xvQueryBestSizeReq);
@@ -805,19 +809,22 @@ ProcXvQueryBestSize(ClientPtr client)
         return status;
     }
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-
     (*pPort->pAdaptor->ddQueryBestSize) (client, pPort, stuff->motion,
                                          stuff->vid_w, stuff->vid_h,
                                          stuff->drw_w, stuff->drw_h,
                                          &actual_width, &actual_height);
 
-    rep.actual_width = actual_width;
-    rep.actual_height = actual_height;
+    {
+        xvQueryBestSizeReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .actual_width = actual_width,
+            .actual_height = actual_height
+        };
 
-    _WriteQueryBestSizeReply(client, &rep);
+        _WriteQueryBestSizeReply(client, &rep);
+    }
 
     return Success;
 }
@@ -828,7 +835,6 @@ ProcXvQueryPortAttributes(ClientPtr client)
     int status, size, i;
     XvPortPtr pPort;
     XvAttributePtr pAtt;
-    xvQueryPortAttributesReply rep;
     xvAttributeInfo Info;
 
     REQUEST(xvQueryPortAttributesReq);
@@ -841,21 +847,25 @@ ProcXvQueryPortAttributes(ClientPtr client)
         return status;
     }
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.num_attributes = pPort->pAdaptor->nAttributes;
-    rep.text_size = 0;
+    size = 0;
 
     for (i = 0, pAtt = pPort->pAdaptor->pAttributes;
          i < pPort->pAdaptor->nAttributes; i++, pAtt++) {
-        rep.text_size += pad_to_int32(strlen(pAtt->name) + 1);
+        size += pad_to_int32(strlen(pAtt->name) + 1);
     }
 
-    rep.length = (pPort->pAdaptor->nAttributes * sz_xvAttributeInfo)
-        + rep.text_size;
-    rep.length >>= 2;
-
-    _WriteQueryPortAttributesReply(client, &rep);
+    {
+        xvQueryPortAttributesReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = ((pPort->pAdaptor->nAttributes * sz_xvAttributeInfo)
+                       + size) >> 2,
+            .num_attributes = pPort->pAdaptor->nAttributes,
+            .text_size = size
+        };
+
+        _WriteQueryPortAttributesReply(client, &rep);
+    }
 
     for (i = 0, pAtt = pPort->pAdaptor->pAttributes;
          i < pPort->pAdaptor->nAttributes; i++, pAtt++) {
@@ -1046,7 +1056,6 @@ ProcXvShmPutImage(ClientPtr client)
 static int
 ProcXvQueryImageAttributes(ClientPtr client)
 {
-    xvQueryImageAttributesReply rep;
     int size, num_planes, i;
     CARD16 width, height;
     XvImagePtr pImage = NULL;
@@ -1089,15 +1098,19 @@ ProcXvQueryImageAttributes(ClientPtr client)
                                                        &width, &height, offsets,
                                                        pitches);
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = planeLength = num_planes << 1;
-    rep.num_planes = num_planes;
-    rep.width = width;
-    rep.height = height;
-    rep.data_size = size;
-
-    _WriteQueryImageAttributesReply(client, &rep);
+    {
+        xvQueryImageAttributesReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = planeLength = num_planes << 1,
+            .num_planes = num_planes,
+            .width = width,
+            .height = height,
+            .data_size = size
+        };
+
+        _WriteQueryImageAttributesReply(client, &rep);
+    }
     if (client->swapped)
         SwapLongs((CARD32 *) offsets, planeLength);
     WriteToClient(client, planeLength << 2, offsets);
@@ -1113,7 +1126,6 @@ ProcXvListImageFormats(ClientPtr client)
     XvPortPtr pPort;
     XvImagePtr pImage;
     int i;
-    xvListImageFormatsReply rep;
     xvImageFormatInfo info;
 
     REQUEST(xvListImageFormatsReq);
@@ -1122,13 +1134,17 @@ ProcXvListImageFormats(ClientPtr client)
 
     VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.num_formats = pPort->pAdaptor->nImages;
-    rep.length =
-        bytes_to_int32(pPort->pAdaptor->nImages * sz_xvImageFormatInfo);
+    {
+        xvListImageFormatsReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = bytes_to_int32(pPort->pAdaptor->nImages *
+                                     sz_xvImageFormatInfo),
+            .num_formats = pPort->pAdaptor->nImages
+        };
 
-    _WriteListImageFormatsReply(client, &rep);
+        _WriteListImageFormatsReply(client, &rep);
+    }
 
     pImage = pPort->pAdaptor->pImages;
 
diff --git a/Xext/xvmc.c b/Xext/xvmc.c
index b008bfe..e63fe99 100644
--- a/Xext/xvmc.c
+++ b/Xext/xvmc.c
@@ -109,15 +109,17 @@ XvMCDestroySubpictureRes(pointer data, XID id)
 static int
 ProcXvMCQueryVersion(ClientPtr client)
 {
-    xvmcQueryVersionReply rep;
+    xvmcQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .major = SERVER_XVMC_MAJOR_VERSION,
+        .minor = SERVER_XVMC_MINOR_VERSION
+    };
 
     /* REQUEST(xvmcQueryVersionReq); */
     REQUEST_SIZE_MATCH(xvmcQueryVersionReq);
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.major = SERVER_XVMC_MAJOR_VERSION;
-    rep.minor = SERVER_XVMC_MINOR_VERSION;
+
     WriteToClient(client, sizeof(xvmcQueryVersionReply), &rep);
     return Success;
 }
@@ -128,7 +130,7 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
     XvPortPtr pPort;
     int i;
     XvMCScreenPtr pScreenPriv;
-    xvmcListSurfaceTypesReply rep;
+    int num_surfaces;
     xvmcSurfaceInfo info;
     XvMCAdaptorPtr adaptor = NULL;
     XvMCSurfaceInfoPtr surface;
@@ -151,14 +153,20 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
         }
     }
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.num = (adaptor) ? adaptor->num_surfaces : 0;
-    rep.length = bytes_to_int32(rep.num * sizeof(xvmcSurfaceInfo));
+    num_surfaces = (adaptor) ? adaptor->num_surfaces : 0;
+
+    {
+        xvmcListSurfaceTypesReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = bytes_to_int32(num_surfaces * sizeof(xvmcSurfaceInfo)),
+            .num = num_surfaces
+        };
 
-    WriteToClient(client, sizeof(xvmcListSurfaceTypesReply), &rep);
+        WriteToClient(client, sizeof(xvmcListSurfaceTypesReply), &rep);
+    }
 
-    for (i = 0; i < rep.num; i++) {
+    for (i = 0; i < num_surfaces; i++) {
         surface = adaptor->surfaces[i];
         info.surface_type_id = surface->surface_type_id;
         info.chroma_format = surface->chroma_format;
@@ -186,7 +194,6 @@ ProcXvMCCreateContext(ClientPtr client)
     XvMCScreenPtr pScreenPriv;
     XvMCAdaptorPtr adaptor = NULL;
     XvMCSurfaceInfoPtr surface = NULL;
-    xvmcCreateContextReply rep;
 
     REQUEST(xvmcCreateContextReq);
     REQUEST_SIZE_MATCH(xvmcCreateContextReq);
@@ -246,22 +253,25 @@ ProcXvMCCreateContext(ClientPtr client)
         free(pContext);
         return result;
     }
-
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.width_actual = pContext->width;
-    rep.height_actual = pContext->height;
-    rep.flags_return = pContext->flags;
-    rep.length = dwords;
-
-    WriteToClient(client, sizeof(xvmcCreateContextReply), &rep);
-    if (dwords)
-        WriteToClient(client, dwords << 2, data);
-    AddResource(pContext->context_id, XvMCRTContext, pContext);
-
-    free(data);
-
-    return Success;
+    else {
+        xvmcCreateContextReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = dwords,
+            .width_actual = pContext->width,
+            .height_actual = pContext->height,
+            .flags_return = pContext->flags
+        };
+
+        WriteToClient(client, sizeof(xvmcCreateContextReply), &rep);
+        if (dwords)
+            WriteToClient(client, dwords << 2, data);
+        AddResource(pContext->context_id, XvMCRTContext, pContext);
+
+        free(data);
+
+        return Success;
+    }
 }
 
 static int
@@ -292,7 +302,6 @@ ProcXvMCCreateSurface(ClientPtr client)
     XvMCContextPtr pContext;
     XvMCSurfacePtr pSurface;
     XvMCScreenPtr pScreenPriv;
-    xvmcCreateSurfaceReply rep;
 
     REQUEST(xvmcCreateSurfaceReq);
     REQUEST_SIZE_MATCH(xvmcCreateSurfaceReq);
@@ -320,21 +329,25 @@ ProcXvMCCreateSurface(ClientPtr client)
         free(pSurface);
         return result;
     }
+    else {
+        xvmcCreateSurfaceReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = dwords
+        };
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = dwords;
+        WriteToClient(client, sizeof(xvmcCreateSurfaceReply), &rep);
 
-    WriteToClient(client, sizeof(xvmcCreateSurfaceReply), &rep);
-    if (dwords)
-        WriteToClient(client, dwords << 2, data);
-    AddResource(pSurface->surface_id, XvMCRTSurface, pSurface);
+        if (dwords)
+            WriteToClient(client, dwords << 2, data);
+        AddResource(pSurface->surface_id, XvMCRTSurface, pSurface);
 
-    free(data);
+        free(data);
 
-    pContext->refcnt++;
+        pContext->refcnt++;
 
-    return Success;
+        return Success;
+    }
 }
 
 static int
@@ -365,7 +378,6 @@ ProcXvMCCreateSubpicture(ClientPtr client)
     XvMCContextPtr pContext;
     XvMCSubpicturePtr pSubpicture;
     XvMCScreenPtr pScreenPriv;
-    xvmcCreateSubpictureReply rep;
     XvMCAdaptorPtr adaptor;
     XvMCSurfaceInfoPtr surface = NULL;
 
@@ -435,29 +447,32 @@ ProcXvMCCreateSubpicture(ClientPtr client)
         free(pSubpicture);
         return result;
     }
-
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.width_actual = pSubpicture->width;
-    rep.height_actual = pSubpicture->height;
-    rep.num_palette_entries = pSubpicture->num_palette_entries;
-    rep.entry_bytes = pSubpicture->entry_bytes;
-    rep.component_order[0] = pSubpicture->component_order[0];
-    rep.component_order[1] = pSubpicture->component_order[1];
-    rep.component_order[2] = pSubpicture->component_order[2];
-    rep.component_order[3] = pSubpicture->component_order[3];
-    rep.length = dwords;
-
-    WriteToClient(client, sizeof(xvmcCreateSubpictureReply), &rep);
-    if (dwords)
-        WriteToClient(client, dwords << 2, data);
-    AddResource(pSubpicture->subpicture_id, XvMCRTSubpicture, pSubpicture);
-
-    free(data);
-
-    pContext->refcnt++;
-
-    return Success;
+    else {
+        xvmcCreateSubpictureReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = dwords,
+            .width_actual = pSubpicture->width,
+            .height_actual = pSubpicture->height,
+            .num_palette_entries = pSubpicture->num_palette_entries,
+            .entry_bytes = pSubpicture->entry_bytes,
+            .component_order[0] = pSubpicture->component_order[0],
+            .component_order[1] = pSubpicture->component_order[1],
+            .component_order[2] = pSubpicture->component_order[2],
+            .component_order[3] = pSubpicture->component_order[3]
+        };
+
+        WriteToClient(client, sizeof(xvmcCreateSubpictureReply), &rep);
+        if (dwords)
+            WriteToClient(client, dwords << 2, data);
+        AddResource(pSubpicture->subpicture_id, XvMCRTSubpicture, pSubpicture);
+
+        free(data);
+
+        pContext->refcnt++;
+
+        return Success;
+    }
 }
 
 static int
@@ -483,14 +498,13 @@ static int
 ProcXvMCListSubpictureTypes(ClientPtr client)
 {
     XvPortPtr pPort;
-    xvmcListSubpictureTypesReply rep;
     XvMCScreenPtr pScreenPriv;
     ScreenPtr pScreen;
     XvMCAdaptorPtr adaptor = NULL;
     XvMCSurfaceInfoPtr surface = NULL;
     xvImageFormatInfo info;
     XvImagePtr pImage;
-    int i, j;
+    int i, j, num;
 
     REQUEST(xvmcListSubpictureTypesReq);
     REQUEST_SIZE_MATCH(xvmcListSubpictureTypesReq);
@@ -524,18 +538,23 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
 
     if (!surface)
         return BadMatch;
+    else {
+        xvmcListSubpictureTypesReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+        };
+        if (surface->compatible_subpictures)
+            num = surface->compatible_subpictures->num_xvimages;
+        else
+            num = 0;
+
+        rep.num = num;
+        rep.length = bytes_to_int32(rep.num * sizeof(xvImageFormatInfo));
+
+        WriteToClient(client, sizeof(xvmcListSubpictureTypesReply), &rep);
+    }
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.num = 0;
-    if (surface->compatible_subpictures)
-        rep.num = surface->compatible_subpictures->num_xvimages;
-
-    rep.length = bytes_to_int32(rep.num * sizeof(xvImageFormatInfo));
-
-    WriteToClient(client, sizeof(xvmcListSubpictureTypesReply), &rep);
-
-    for (i = 0; i < rep.num; i++) {
+    for (i = 0; i < num; i++) {
         pImage = NULL;
         for (j = 0; j < adaptor->num_subpictures; j++) {
             if (surface->compatible_subpictures->xvimage_ids[i] ==
@@ -578,7 +597,10 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
 static int
 ProcXvMCGetDRInfo(ClientPtr client)
 {
-    xvmcGetDRInfoReply rep;
+    xvmcGetDRInfoReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence
+    };
     XvPortPtr pPort;
     ScreenPtr pScreen;
     XvMCScreenPtr pScreenPriv;
@@ -595,8 +617,6 @@ ProcXvMCGetDRInfo(ClientPtr client)
     pScreen = pPort->pAdaptor->pScreen;
     pScreenPriv = XVMC_GET_PRIVATE(pScreen);
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
     rep.major = pScreenPriv->major;
     rep.minor = pScreenPriv->minor;
     rep.patchLevel = pScreenPriv->patchLevel;
-- 
1.7.9.2



More information about the xorg-devel mailing list