From 84b8ac1b33de70d4085e93ad1535aa864d6e6bfc Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Wed, 16 Jul 2025 16:04:06 +0200 Subject: [PATCH] dix: add WriteRpcbufToClient() Adding convenience function for writing out rpc buffer contents to client and clear the buffer (free it's memory) afterwards. Signed-off-by: Enrico Weigelt, metux IT consult --- dix/dix_priv.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dix/dix_priv.h b/dix/dix_priv.h index a0843cdc64..fc22d02fa5 100644 --- a/dix/dix_priv.h +++ b/dix/dix_priv.h @@ -19,6 +19,7 @@ #include "dix/input_priv.h" #include "dix/resource_priv.h" +#include "dix/rpcbuf_priv.h" #include "include/callback.h" #include "include/cursor.h" @@ -689,4 +690,18 @@ static inline ClientPtr dixLookupXIDOwner(XID xid) return NULL; } +/* + * @brief write rpc buffer to client and then clear it + * + * @param pClient the client to write buffer to + * @param rpcbuf the buffer whose contents will be written + * @return the result of WriteToClient() call + */ +static inline int WriteRpcbufToClient(ClientPtr pClient, + x_rpcbuf_t *rpcbuf) { + int ret = WriteToClient(pClient, rpcbuf->wpos, rpcbuf->buffer); + x_rpcbuf_clear(rpcbuf); + return ret; +} + #endif /* _XSERVER_DIX_PRIV_H */