aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2018-01-03 04:25:42 +0300
committerZyX <kp-pav@yandex.ru>2018-01-14 01:33:18 +0300
commit6a1557f2f496bf8e8f4dad7ed0d423051a7b65e2 (patch)
treee00517056c7dc44208a5d83e94b12eb18556537c /src/nvim/eval.c
parentc10ae4bc8548ca170876e00489fb5d907801e553 (diff)
downloadrneovim-6a1557f2f496bf8e8f4dad7ed0d423051a7b65e2.tar.gz
rneovim-6a1557f2f496bf8e8f4dad7ed0d423051a7b65e2.tar.bz2
rneovim-6a1557f2f496bf8e8f4dad7ed0d423051a7b65e2.zip
eval/typval: Log list actions
New logging is guarded by cmake LOG_LIST_ACTIONS define. To make it more efficient it is allocated as a linked list with chunks of length 2^(7+chunk_num); that uses basically the same idea as behind increasing kvec length (make appending O(1) (amortized)), but reduces constant by not bothering to move memory around what realloc() would surely do: it is not like we need random access to log entries here to justify usage of a single continuous memory block.
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index ec32f1821d..55396b070d 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -16665,6 +16665,18 @@ static void f_test_garbagecollect_now(typval_T *argvars,
garbage_collect(true);
}
+// "test_write_list_log()" function
+static void f_test_write_list_log(typval_T *const argvars,
+ typval_T *const rettv,
+ FunPtr fptr)
+{
+ const char *const fname = tv_get_string_chk(&argvars[0]);
+ if (fname == NULL) {
+ return;
+ }
+ list_write_log(fname);
+}
+
bool callback_from_typval(Callback *const callback, typval_T *const arg)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
{