From 0ef80b9c2b922280c3ba2c0a8638f23ae57d6618 Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Tue, 30 Jun 2015 13:37:19 -0300 Subject: rbuffer: Reimplement as a ring buffer and decouple from rstream Extract the RBuffer class from rstream.c and reimplement it as a ring buffer, a more efficient version that doesn't need to relocate memory. The old rbuffer_read/rbuffer_write interfaces are kept for simple reading/writing, and the RBUFFER_UNTIL_{FULL,EMPTY} macros are introduced to hide wrapping logic when more control is required(such as passing the buffer pointer to a library function that writes directly to the pointer) Also add a basic infrastructure for writing helper C files that are only compiled in the unit test library, and use this to write unit tests for RBuffer which contains some macros that can't be accessed directly by luajit. Helped-by: oni-link Reviewed-by: oni-link Reviewed-by: Scott Prager Reviewed-by: Justin M. Keyes Reviewed-by: Michael Reed --- src/nvim/memory.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/memory.h') diff --git a/src/nvim/memory.h b/src/nvim/memory.h index 4ff31ff732..7b477da2f5 100644 --- a/src/nvim/memory.h +++ b/src/nvim/memory.h @@ -1,6 +1,7 @@ #ifndef NVIM_MEMORY_H #define NVIM_MEMORY_H +#include // for uint8_t #include // for size_t #ifdef INCLUDE_GENERATED_DECLARATIONS -- cgit