[PATCH 03/19] Use C99 designated initializers in SendErrorToClient
Alan Coopersmith
alan.coopersmith at oracle.com
Sun Jun 24 10:25:10 PDT 2012
Let the compiler worry about 0-filling the rest of the fields,
instead of memsetting the whole struct and then going back to
overwrite some of the fields.
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
dix/dispatch.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 0969d8e..a472227 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -3619,14 +3619,13 @@ void
SendErrorToClient(ClientPtr client, unsigned majorCode, unsigned minorCode,
XID resId, int errorCode)
{
- xError rep;
-
- memset(&rep, 0, sizeof(xError));
- rep.type = X_Error;
- rep.errorCode = errorCode;
- rep.majorCode = majorCode;
- rep.minorCode = minorCode;
- rep.resourceID = resId;
+ xError rep = {
+ .type = X_Error,
+ .errorCode = errorCode,
+ .resourceID = resId,
+ .minorCode = minorCode,
+ .majorCode = majorCode
+ };
WriteEventsToClient(client, 1, (xEvent *) &rep);
}
--
1.7.9.2
More information about the xorg-devel
mailing list