aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/undo.c
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2016-08-20 23:56:49 +0300
committerZyX <kp-pav@yandex.ru>2017-03-29 10:07:43 +0300
commit2dcfc439b2ec2be4d830826061e89860977516be (patch)
treef5f3b73e9f579ffe9388574538e50be18cd13d44 /src/nvim/undo.c
parent210342d795a13e88579d3e55ae931463d16f241d (diff)
downloadrneovim-2dcfc439b2ec2be4d830826061e89860977516be.tar.gz
rneovim-2dcfc439b2ec2be4d830826061e89860977516be.tar.bz2
rneovim-2dcfc439b2ec2be4d830826061e89860977516be.zip
eval: Split and move dict_add_nr_str to typval.c
Function was split into tv_dict_add_nr() and tv_dict_add_str().
Diffstat (limited to 'src/nvim/undo.c')
-rw-r--r--src/nvim/undo.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/nvim/undo.c b/src/nvim/undo.c
index 8c75d28f2a..ba687bf6da 100644
--- a/src/nvim/undo.c
+++ b/src/nvim/undo.c
@@ -2943,19 +2943,22 @@ void u_eval_tree(u_header_T *first_uhp, list_T *list)
while (uhp != NULL) {
dict = tv_dict_alloc();
- dict_add_nr_str(dict, "seq", uhp->uh_seq, NULL);
- dict_add_nr_str(dict, "time", (long)uhp->uh_time, NULL);
- if (uhp == curbuf->b_u_newhead)
- dict_add_nr_str(dict, "newhead", 1, NULL);
- if (uhp == curbuf->b_u_curhead)
- dict_add_nr_str(dict, "curhead", 1, NULL);
- if (uhp->uh_save_nr > 0)
- dict_add_nr_str(dict, "save", uhp->uh_save_nr, NULL);
+ tv_dict_add_nr(dict, S_LEN("seq"), (varnumber_T)uhp->uh_seq);
+ tv_dict_add_nr(dict, S_LEN("time"), (varnumber_T)uhp->uh_time);
+ if (uhp == curbuf->b_u_newhead) {
+ tv_dict_add_nr(dict, S_LEN("newhead"), 1);
+ }
+ if (uhp == curbuf->b_u_curhead) {
+ tv_dict_add_nr(dict, S_LEN("curhead"), 1);
+ }
+ if (uhp->uh_save_nr > 0) {
+ tv_dict_add_nr(dict, S_LEN("save"), (varnumber_T)uhp->uh_save_nr);
+ }
if (uhp->uh_alt_next.ptr != NULL) {
list_T *alt_list = tv_list_alloc();
- /* Recursive call to add alternate undo tree. */
+ // Recursive call to add alternate undo tree.
u_eval_tree(uhp->uh_alt_next.ptr, alt_list);
tv_dict_add_list(dict, S_LEN("alt"), alt_list);
}