dix: rpcbuf: flag for auto-clear in error case

when the err_clear flag is set, the buffer memory will automatically
be free()ed when allocation failed. This allows simplificatoin of
caller's error pathes: the caller doesn't need to to call x_rpcbuf_clear()
anymore and eg. can directly return out.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-07-17 14:58:45 +02:00
parent d90620f363
commit 4efe7768f1
2 changed files with 14 additions and 8 deletions

View File

@@ -32,6 +32,7 @@ typedef struct x_rpcbuf {
char *buffer; /* pointer to whole buffer */
Bool swapped; /* TRUE when typed write operation shall byte-swap */
Bool error; /* TRUE when the last allocation failed */
Bool err_clear; /* set to TRUE if should automatically clear on error */
} x_rpcbuf_t;
#define XLIBRE_RPCBUF_CHUNK_SIZE 4096