From 2d6f57b2891247f9ca0f6fb75c4b93fb2c714dc4 Mon Sep 17 00:00:00 2001 From: bfredl Date: Tue, 10 Dec 2024 14:03:44 +0100 Subject: refactor(wininfo): change wininfo from a linked list to an array "wininfo" is going to be my next victim. The main problem with wininfo is that it is "all or nothing", i e either all state about a buffer in a window is considered valid or none of it is. This needs to be fixed to address some long running grievances. For now this is just a warmup: refactor it from a linked list to a vector. --- src/klib/kvec.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/klib') diff --git a/src/klib/kvec.h b/src/klib/kvec.h index 1b9e6fd9f8..ea8cbe48cf 100644 --- a/src/klib/kvec.h +++ b/src/klib/kvec.h @@ -135,6 +135,10 @@ : 0UL)), \ &(v).items[(i)])) +#define kv_shift(v, i, n) ((v).size -= (n), (i) < (v).size \ + && memmove(&kv_A(v, (i)), &kv_A(v, (i)+(n)), \ + ((v).size-(i))*sizeof(kv_A(v, i)))) + #define kv_printf(v, ...) kv_do_printf(&(v), __VA_ARGS__) /// Type of a vector with a few first members allocated on stack -- cgit