From 86909b50677f2a1b62a371f7f6d564a851724c79 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Wed, 14 Sep 2016 12:59:59 +0300 Subject: [PATCH] Add macro for checking buffer contiguousness A NULL buffer is considered contiguous. --- server/include/buffer.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/include/buffer.h b/server/include/buffer.h index e5a7fa900..206e87db4 100644 --- a/server/include/buffer.h +++ b/server/include/buffer.h @@ -161,6 +161,9 @@ typedef struct gwbuf /*< Check that the data in a buffer has the SQL marker*/ #define GWBUF_IS_SQL(b) (0x03 == GWBUF_DATA_CHAR(b,4)) +/*< Check whether the buffer is contiguous*/ +#define GWBUF_IS_CONTIGUOUS(b) (((b) == NULL) || ((b)->next == NULL)) + /*< True if all bytes in the buffer have been consumed */ #define GWBUF_EMPTY(b) ((char *)(b)->start >= (char *)(b)->end)