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 <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-07-16 16:04:06 +02:00
committed by Enrico Weigelt
parent f5062223ec
commit 84b8ac1b33

View File

@@ -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 */