xserver: Branch 'master'
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Feb 17 19:04:49 UTC 2025
Xext/xselinux_ext.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
New commits:
commit f4d878086e653ff31deeb31b9121f6b7bd01d901
Author: Enrico Weigelt, metux IT consult <info at metux.net>
Date: Wed Jul 17 12:27:18 2024 +0200
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 at metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1795>
diff --git a/Xext/xselinux_ext.c b/Xext/xselinux_ext.c
index 407c43570..dd5ace348 100644
--- a/Xext/xselinux_ext.c
+++ b/Xext/xselinux_ext.c
@@ -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,
More information about the xorg-commit
mailing list