aboutsummaryrefslogtreecommitdiff
path: root/src/klib
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2024-12-10 14:03:44 +0100
committerbfredl <bjorn.linse@gmail.com>2024-12-16 12:46:59 +0100
commit2d6f57b2891247f9ca0f6fb75c4b93fb2c714dc4 (patch)
treed7bb06b9366e0640d4299a3c7adce644f8e4086e /src/klib
parent9c6a3703bb15d56fecdd962512f69f0ccf6d398c (diff)
downloadrneovim-2d6f57b2891247f9ca0f6fb75c4b93fb2c714dc4.tar.gz
rneovim-2d6f57b2891247f9ca0f6fb75c4b93fb2c714dc4.tar.bz2
rneovim-2d6f57b2891247f9ca0f6fb75c4b93fb2c714dc4.zip
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.
Diffstat (limited to 'src/klib')
-rw-r--r--src/klib/kvec.h4
1 files changed, 4 insertions, 0 deletions
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