From 1e52d33a3696016a7338d08c1c2bf6ef8f324e75 Mon Sep 17 00:00:00 2001 From: Randy Palamar Date: Sat, 4 Jan 2025 21:04:22 -0700 Subject: remove duplicated read_buffer functions When you take a pointer to a function in C that function is going to appear in full in the final binary. This means that there were 3 sections of the final binary with the exact same code. You could argue that in very high performance programs having that function closer to the current instruction when it is needed will give a performance boost but there are so many other places to gain more significant speed ups in vis before that would be remotely relevant. In fact, removing these allows the buffer_append call to inlined so that buffer_insert can be hopped to directly instead of including a useless hop in the middle. --- buffer.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'buffer.h') diff --git a/buffer.h b/buffer.h index 321d54a..d9e2b85 100644 --- a/buffer.h +++ b/buffer.h @@ -80,4 +80,7 @@ const char *buffer_content(Buffer*); */ char *buffer_move(Buffer*); +/** ``read(3p)`` like interface for reading into a Buffer (``context``) */ +ssize_t read_into_buffer(void *context, char *data, size_t len); + #endif -- cgit v1.2.3