diff options
Diffstat (limited to 'src/nvim/rbuffer.c')
-rw-r--r-- | src/nvim/rbuffer.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/src/nvim/rbuffer.c b/src/nvim/rbuffer.c index f74f68adb6..ef286b3e22 100644 --- a/src/nvim/rbuffer.c +++ b/src/nvim/rbuffer.c @@ -3,13 +3,12 @@ #include <stddef.h> #include <string.h> -#include "nvim/func_attr.h" #include "nvim/macros_defs.h" #include "nvim/memory.h" #include "nvim/rbuffer.h" #ifdef INCLUDE_GENERATED_DECLARATIONS -# include "rbuffer.c.generated.h" // IWYU pragma: export +# include "rbuffer.c.generated.h" #endif /// Creates a new `RBuffer` instance. @@ -30,27 +29,12 @@ RBuffer *rbuffer_new(size_t capacity) return rv; } -void rbuffer_free(RBuffer *buf) +void rbuffer_free(RBuffer *buf) FUNC_ATTR_NONNULL_ALL { xfree(buf->temp); xfree(buf); } -size_t rbuffer_size(RBuffer *buf) FUNC_ATTR_NONNULL_ALL -{ - return buf->size; -} - -size_t rbuffer_capacity(RBuffer *buf) FUNC_ATTR_NONNULL_ALL -{ - return (size_t)(buf->end_ptr - buf->start_ptr); -} - -size_t rbuffer_space(RBuffer *buf) FUNC_ATTR_NONNULL_ALL -{ - return rbuffer_capacity(buf) - buf->size; -} - /// Return a pointer to a raw buffer containing the first empty slot available /// for writing. The second argument is a pointer to the maximum number of /// bytes that could be written. @@ -214,7 +198,7 @@ size_t rbuffer_read(RBuffer *buf, char *dst, size_t dst_size) } char *rbuffer_get(RBuffer *buf, size_t index) - FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_RET + FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_RET { assert(index < buf->size); char *rptr = buf->read_ptr + index; @@ -229,7 +213,7 @@ int rbuffer_cmp(RBuffer *buf, const char *str, size_t count) { assert(count <= buf->size); size_t rcnt; - (void)rbuffer_read_ptr(buf, &rcnt); + rbuffer_read_ptr(buf, &rcnt); size_t n = MIN(count, rcnt); int rv = memcmp(str, buf->read_ptr, n); count -= n; |