(submit/cleanup-xv-dispatch) Xext: xv: use static struct initialization on declaration

A little bit of code simplification by using static initialization
of struct right at the point of declaration. Also dropping a few now
unneccessary zero assignments.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-07-08 18:47:45 +02:00
parent fc82a71e35
commit 3ab8f10b65

View File

@ -323,7 +323,6 @@ ProcXvQueryAdaptors(ClientPtr client)
{
xvFormat format;
xvAdaptorInfo ainfo;
xvQueryAdaptorsReply rep;
int totalSize, na, nf, rc;
int nameSize;
XvAdaptorPtr pa;
@ -339,27 +338,20 @@ ProcXvQueryAdaptors(ClientPtr client)
if (rc != Success)
return rc;
xvQueryAdaptorsReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
};
pScreen = pWin->drawable.pScreen;
pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
XvGetScreenKey());
if (!pxvs) {
rep = (xvQueryAdaptorsReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.num_adaptors = 0
};
_WriteQueryAdaptorsReply(client, &rep);
return Success;
}
rep = (xvQueryAdaptorsReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.num_adaptors = pxvs->nAdaptors
};
rep.num_adaptors = pxvs->nAdaptors;
/* CALCULATE THE TOTAL SIZE OF THE REPLY IN BYTES */
@ -413,7 +405,6 @@ static int
ProcXvQueryEncodings(ClientPtr client)
{
xvEncodingInfo einfo;
xvQueryEncodingsReply rep;
int totalSize;
int nameSize;
XvPortPtr pPort;
@ -425,12 +416,6 @@ ProcXvQueryEncodings(ClientPtr client)
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
rep = (xvQueryEncodingsReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.num_encodings = pPort->pAdaptor->nEncodings
};
/* FOR EACH ENCODING ADD UP THE BYTES FOR ENCODING NAMES */
ne = pPort->pAdaptor->nEncodings;
@ -441,7 +426,12 @@ ProcXvQueryEncodings(ClientPtr client)
pe++;
}
rep.length = bytes_to_int32(totalSize);
xvQueryEncodingsReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.num_encodings = pPort->pAdaptor->nEncodings,
.length = bytes_to_int32(totalSize),
};
_WriteQueryEncodingsReply(client, &rep);
@ -617,7 +607,6 @@ ProcXvGrabPort(ClientPtr client)
{
int result, status;
XvPortPtr pPort;
xvGrabPortReply rep;
REQUEST(xvGrabPortReq);
REQUEST_SIZE_MATCH(xvGrabPortReq);
@ -629,10 +618,9 @@ ProcXvGrabPort(ClientPtr client)
if (status != Success) {
return status;
}
rep = (xvGrabPortReply) {
xvGrabPortReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.result = result
};
@ -706,7 +694,6 @@ ProcXvGetPortAttribute(ClientPtr client)
INT32 value;
int status;
XvPortPtr pPort;
xvGetPortAttributeReply rep;
REQUEST(xvGetPortAttributeReq);
REQUEST_SIZE_MATCH(xvGetPortAttributeReq);
@ -724,10 +711,9 @@ ProcXvGetPortAttribute(ClientPtr client)
return status;
}
rep = (xvGetPortAttributeReply) {
xvGetPortAttributeReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.value = value
};
@ -741,7 +727,6 @@ ProcXvQueryBestSize(ClientPtr client)
{
unsigned int actual_width, actual_height;
XvPortPtr pPort;
xvQueryBestSizeReply rep;
REQUEST(xvQueryBestSizeReq);
REQUEST_SIZE_MATCH(xvQueryBestSizeReq);
@ -753,10 +738,9 @@ ProcXvQueryBestSize(ClientPtr client)
stuff->drw_w, stuff->drw_h,
&actual_width, &actual_height);
rep = (xvQueryBestSizeReply) {
xvQueryBestSizeReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.actual_width = actual_width,
.actual_height = actual_height
};
@ -772,7 +756,6 @@ ProcXvQueryPortAttributes(ClientPtr client)
int size, i;
XvPortPtr pPort;
XvAttributePtr pAtt;
xvQueryPortAttributesReply rep;
xvAttributeInfo Info;
REQUEST(xvQueryPortAttributesReq);
@ -780,11 +763,10 @@ ProcXvQueryPortAttributes(ClientPtr client)
VALIDATE_XV_PORT(stuff->port, pPort, DixGetAttrAccess);
rep = (xvQueryPortAttributesReply) {
xvQueryPortAttributesReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.num_attributes = pPort->pAdaptor->nAttributes,
.text_size = 0
};
for (i = 0, pAtt = pPort->pAdaptor->pAttributes;
@ -1031,7 +1013,6 @@ ProcXvListImageFormats(ClientPtr client)
XvPortPtr pPort;
XvImagePtr pImage;
int i;
xvListImageFormatsReply rep;
xvImageFormatInfo info;
REQUEST(xvListImageFormatsReq);
@ -1040,7 +1021,7 @@ ProcXvListImageFormats(ClientPtr client)
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
rep = (xvListImageFormatsReply) {
xvListImageFormatsReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.num_formats = pPort->pAdaptor->nImages,