mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-04-18 02:40:38 +02:00
Xext: selinux: use static reply struct init on declaration
Make the code a bit easier to read by using initialization of the reply structs, at the point of declaration. Most of them aren't written to later, just passed into WriteReplyToClient(). Also dropping some useless zero assignments (struct initializers automatically zero-out unmentioned fields). Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1795>
This commit is contained in:
parent
94d942267a
commit
f4d878086e
1 changed files with 4 additions and 10 deletions
|
|
@ -70,7 +70,6 @@ ProcSELinuxQueryVersion(ClientPtr client)
|
|||
SELinuxQueryVersionReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.server_major = SELINUX_MAJOR_VERSION,
|
||||
.server_minor = SELINUX_MINOR_VERSION
|
||||
};
|
||||
|
|
@ -87,7 +86,6 @@ ProcSELinuxQueryVersion(ClientPtr client)
|
|||
static int
|
||||
SELinuxSendContextReply(ClientPtr client, security_id_t sid)
|
||||
{
|
||||
SELinuxGetContextReply rep;
|
||||
char *ctx = NULL;
|
||||
int len = 0;
|
||||
|
||||
|
|
@ -97,7 +95,7 @@ SELinuxSendContextReply(ClientPtr client, security_id_t sid)
|
|||
len = strlen(ctx) + 1;
|
||||
}
|
||||
|
||||
rep = (SELinuxGetContextReply) {
|
||||
SELinuxGetContextReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = bytes_to_int32(len),
|
||||
|
|
@ -344,13 +342,9 @@ static int
|
|||
SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
|
||||
int size, int count)
|
||||
{
|
||||
int rc, k, pos = 0;
|
||||
SELinuxListItemsReply rep;
|
||||
CARD32 *buf;
|
||||
|
||||
buf = calloc(size, sizeof(CARD32));
|
||||
int rc = BadAlloc, k, pos = 0;
|
||||
CARD32 *buf = calloc(size, sizeof(CARD32));
|
||||
if (size && !buf) {
|
||||
rc = BadAlloc;
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
@ -378,7 +372,7 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
|
|||
}
|
||||
|
||||
/* Send reply to client */
|
||||
rep = (SELinuxListItemsReply) {
|
||||
SELinuxListItemsReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = size,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue