summaryrefslogtreecommitdiff
path: root/hw/xfree86/dri
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2012-07-09 19:12:43 -0700
committerKeith Packard <keithp@keithp.com>2012-07-09 22:52:30 -0700
commit483266a583b0fd8a552303f318a71502ce3ff1d2 (patch)
tree034221a23c7484d028e4fcdf8ea880283370146a /hw/xfree86/dri
parent14501fd33ee89acf9fc1d908003ed62f383d8bae (diff)
Use C99 designated initializers in xf86 extension Replies
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 'hw/xfree86/dri')
-rw-r--r--hw/xfree86/dri/xf86dri.c112
1 files changed, 58 insertions, 54 deletions
diff --git a/hw/xfree86/dri/xf86dri.c b/hw/xfree86/dri/xf86dri.c
index 43504b7fe..310bb5e4e 100644
--- a/hw/xfree86/dri/xf86dri.c
+++ b/hw/xfree86/dri/xf86dri.c
@@ -78,15 +78,16 @@ XF86DRIResetProc(ExtensionEntry * extEntry)
static int
ProcXF86DRIQueryVersion(register ClientPtr client)
{
- xXF86DRIQueryVersionReply rep;
+ xXF86DRIQueryVersionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .majorVersion = SERVER_XF86DRI_MAJOR_VERSION,
+ .minorVersion = SERVER_XF86DRI_MINOR_VERSION,
+ .patchVersion = SERVER_XF86DRI_PATCH_VERSION
+ };
REQUEST_SIZE_MATCH(xXF86DRIQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = SERVER_XF86DRI_MAJOR_VERSION;
- rep.minorVersion = SERVER_XF86DRI_MINOR_VERSION;
- rep.patchVersion = SERVER_XF86DRI_PATCH_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -111,18 +112,20 @@ ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
return BadValue;
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
if (!DRIQueryDirectRenderingCapable(screenInfo.screens[stuff->screen],
&isCapable)) {
return BadValue;
}
- rep.isCapable = isCapable;
if (!LocalClient(client) || client->swapped)
- rep.isCapable = 0;
+ isCapable = 0;
+
+ rep = (xXF86DRIQueryDirectRenderingCapableReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .isCapable = isCapable
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
@@ -158,20 +161,21 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
if (busIdString)
busIdStringLength = strlen(busIdString);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.busIdStringLength = busIdStringLength;
- rep.length =
- bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) -
- SIZEOF(xGenericReply) +
- pad_to_int32(rep.busIdStringLength));
+ rep = (xXF86DRIOpenConnectionReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) -
+ SIZEOF(xGenericReply) +
+ pad_to_int32(busIdStringLength)),
+ .busIdStringLength = busIdStringLength,
- rep.hSAREALow = (CARD32) (hSAREA & 0xffffffff);
+ .hSAREALow = (CARD32) (hSAREA & 0xffffffff),
#if defined(LONG64) && !defined(__linux__)
- rep.hSAREAHigh = (CARD32) (hSAREA >> 32);
+ .hSAREAHigh = (CARD32) (hSAREA >> 32),
#else
- rep.hSAREAHigh = 0;
+ .hSAREAHigh = 0
#endif
+ };
WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), &rep);
if (busIdStringLength)
@@ -182,7 +186,12 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
static int
ProcXF86DRIAuthConnection(register ClientPtr client)
{
- xXF86DRIAuthConnectionReply rep;
+ xXF86DRIAuthConnectionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .authenticated = 1
+ };
REQUEST(xXF86DRIAuthConnectionReq);
REQUEST_SIZE_MATCH(xXF86DRIAuthConnectionReq);
@@ -191,11 +200,6 @@ ProcXF86DRIAuthConnection(register ClientPtr client)
return BadValue;
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.authenticated = 1;
-
if (!DRIAuthConnection(screenInfo.screens[stuff->screen], stuff->magic)) {
ErrorF("Failed to authenticate %lu\n", (unsigned long) stuff->magic);
rep.authenticated = 0;
@@ -222,7 +226,11 @@ ProcXF86DRICloseConnection(register ClientPtr client)
static int
ProcXF86DRIGetClientDriverName(register ClientPtr client)
{
- xXF86DRIGetClientDriverNameReply rep;
+ xXF86DRIGetClientDriverNameReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .clientDriverNameLength = 0
+ };
char *clientDriverName;
REQUEST(xXF86DRIGetClientDriverNameReq);
@@ -238,9 +246,6 @@ ProcXF86DRIGetClientDriverName(register ClientPtr client)
(int *) &rep.ddxDriverPatchVersion,
&clientDriverName);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.clientDriverNameLength = 0;
if (clientDriverName)
rep.clientDriverNameLength = strlen(clientDriverName);
rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetClientDriverNameReply) -
@@ -256,7 +261,11 @@ ProcXF86DRIGetClientDriverName(register ClientPtr client)
static int
ProcXF86DRICreateContext(register ClientPtr client)
{
- xXF86DRICreateContextReply rep;
+ xXF86DRICreateContextReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
ScreenPtr pScreen;
REQUEST(xXF86DRICreateContextReq);
@@ -266,10 +275,6 @@ ProcXF86DRICreateContext(register ClientPtr client)
return BadValue;
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
pScreen = screenInfo.screens[stuff->screen];
if (!DRICreateContext(pScreen,
@@ -302,7 +307,11 @@ ProcXF86DRIDestroyContext(register ClientPtr client)
static int
ProcXF86DRICreateDrawable(ClientPtr client)
{
- xXF86DRICreateDrawableReply rep;
+ xXF86DRICreateDrawableReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
DrawablePtr pDrawable;
int rc;
@@ -313,10 +322,6 @@ ProcXF86DRICreateDrawable(ClientPtr client)
return BadValue;
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
DixReadAccess);
if (rc != Success)
@@ -361,7 +366,11 @@ ProcXF86DRIDestroyDrawable(register ClientPtr client)
static int
ProcXF86DRIGetDrawableInfo(register ClientPtr client)
{
- xXF86DRIGetDrawableInfoReply rep;
+ xXF86DRIGetDrawableInfoReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
DrawablePtr pDrawable;
int X, Y, W, H;
drm_clip_rect_t *pClipRects, *pClippedRects;
@@ -375,10 +384,6 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
return BadValue;
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
DixReadAccess);
if (rc != Success)
@@ -466,7 +471,11 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
static int
ProcXF86DRIGetDeviceInfo(register ClientPtr client)
{
- xXF86DRIGetDeviceInfoReply rep;
+ xXF86DRIGetDeviceInfoReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
drm_handle_t hFrameBuffer;
void *pDevPrivate;
@@ -477,10 +486,6 @@ ProcXF86DRIGetDeviceInfo(register ClientPtr client)
return BadValue;
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
if (!DRIGetDeviceInfo(screenInfo.screens[stuff->screen],
&hFrameBuffer,
(int *) &rep.framebufferOrigin,
@@ -497,7 +502,6 @@ ProcXF86DRIGetDeviceInfo(register ClientPtr client)
rep.hFrameBufferHigh = 0;
#endif
- rep.length = 0;
if (rep.devPrivateSize) {
rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetDeviceInfoReply) -
SIZEOF(xGenericReply) +