From: Jason Ish Date: Tue, 4 Mar 2014 16:42:19 +0000 (-0600) Subject: Add macros for access to the underlying buffer and offset. X-Git-Tag: suricata-2.0.2~20 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0a33e73417f48860ea8db9e08723dc5b7ccbfa35;p=thirdparty%2Fsuricata.git Add macros for access to the underlying buffer and offset. Useful for using passing the buffer through to another writer such as LogFileCtx. --- diff --git a/src/util-buffer.h b/src/util-buffer.h index 0ab4583a32..5c592ae43a 100644 --- a/src/util-buffer.h +++ b/src/util-buffer.h @@ -43,6 +43,16 @@ void MemBufferFree(MemBuffer *buffer); (mem_buffer)->offset = 0; \ } while (0) +/** + * \brief Get the MemBuffers underlying buffer. + */ +#define MEMBUFFER_BUFFER(mem_buffer) (mem_buffer)->buffer + +/** + * \brief Get the MemBuffers current offset. + */ +#define MEMBUFFER_OFFSET(mem_buffer) (mem_buffer)->offset + /** * \brief Write a buffer to the file pointer. *