diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-12-09 18:47:34 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-12-09 18:47:34 +0100 |
commit | 3cc7ebf8107bddb42a566ede4c2a51818ff623c5 (patch) | |
tree | e2f7a79ff73ee7a8e2a292f77fdb0df67485e555 /src/nvim/lib/ringbuf.h | |
parent | afae4b514183c490737a28f2946def717e78a11c (diff) | |
parent | fbdc3ac4efbc97e2965b6083d429beabe261461c (diff) | |
download | rneovim-3cc7ebf8107bddb42a566ede4c2a51818ff623c5.tar.gz rneovim-3cc7ebf8107bddb42a566ede4c2a51818ff623c5.tar.bz2 rneovim-3cc7ebf8107bddb42a566ede4c2a51818ff623c5.zip |
Merge #7234 'built-in expression parser'
Diffstat (limited to 'src/nvim/lib/ringbuf.h')
-rw-r--r-- | src/nvim/lib/ringbuf.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/nvim/lib/ringbuf.h b/src/nvim/lib/ringbuf.h index 12b75ec65a..e63eae70b0 100644 --- a/src/nvim/lib/ringbuf.h +++ b/src/nvim/lib/ringbuf.h @@ -15,6 +15,7 @@ #ifndef NVIM_LIB_RINGBUF_H #define NVIM_LIB_RINGBUF_H +#include <stddef.h> #include <string.h> #include <assert.h> #include <stdint.h> @@ -73,6 +74,32 @@ typedef struct { \ RBType *buf_end; \ } TypeName##RingBuffer; +/// Dummy item free macros, for use in RINGBUF_INIT +/// +/// This macros actually does nothing. +/// +/// @param[in] item Item to be freed. +#define RINGBUF_DUMMY_FREE(item) + +/// Static ring buffer +/// +/// @warning Ring buffers created with this macros must neither be freed nor +/// deallocated. +/// +/// @param scope Ring buffer scope. +/// @param TypeName Ring buffer type name. +/// @param RBType Type of the single ring buffer element. +/// @param varname Variable name. +/// @param rbsize Ring buffer size. +#define RINGBUF_STATIC(scope, TypeName, RBType, varname, rbsize) \ +static RBType _##varname##_buf[rbsize]; \ +scope TypeName##RingBuffer varname = { \ + .buf = _##varname##_buf, \ + .next = _##varname##_buf, \ + .first = NULL, \ + .buf_end = _##varname##_buf + rbsize - 1, \ +}; + /// Initialize a new ring buffer /// /// @param TypeName Ring buffer type name. Actual type name will be |