Add macro for checking buffer contiguousness

A NULL buffer is considered contiguous.
This commit is contained in:
Johan Wikman 2016-09-14 12:59:59 +03:00
parent 65ccc6b8fb
commit 86909b5067

View File

@ -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)