dix: let X_SEND_REPLY_WITH_RPCBUF() return status code

Check for rpcbuf error and return BadAlloc then, otherwise return Success.
This way, callers don't need to check their rpcbuf for error on their own
anymore, but can just do return X_SEND_REPLY_WITH_RPCBUF(...).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-08-25 10:44:32 +02:00
parent 953261e160
commit 35d72a759a

View File

@@ -748,9 +748,12 @@ static inline Atom dixGetAtomID(const char *name) {
#define X_REPLY_HEADER_UNITS(hdrtype) \
(pad_to_int32((sizeof(hdrtype) - sizeof(xGenericReply))))
static inline void __write_reply_hdr_and_rpcbuf(
static inline int __write_reply_hdr_and_rpcbuf(
ClientPtr pClient, void *hdrData, size_t hdrLen, x_rpcbuf_t *rpcbuf)
{
if (rpcbuf->error)
return BadAlloc;
xGenericReply *reply = hdrData;
reply->type = X_Reply;
reply->length = (bytes_to_int32(hdrLen - sizeof(xGenericReply)))
@@ -764,6 +767,8 @@ static inline void __write_reply_hdr_and_rpcbuf(
WriteToClient(pClient, hdrLen, hdrData);
WriteRpcbufToClient(pClient, rpcbuf);
return Success;
}
static inline void __write_reply_hdr_simple(