From 14a8b3b98c245087ef431070195f3a2fa3db16c0 Mon Sep 17 00:00:00 2001 From: Hye Sung Jung Date: Fri, 31 Jan 2020 00:56:34 -0600 Subject: doc: fix typos [ci skip] #11787 --- src/nvim/shada.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/nvim/shada.c') diff --git a/src/nvim/shada.c b/src/nvim/shada.c index 2306da94c6..19a14f340b 100644 --- a/src/nvim/shada.c +++ b/src/nvim/shada.c @@ -177,7 +177,7 @@ typedef enum { /// Possible results when reading ShaDa file typedef enum { - kSDReadStatusSuccess, ///< Reading was successfull. + kSDReadStatusSuccess, ///< Reading was successful. kSDReadStatusFinished, ///< Nothing more to read. kSDReadStatusReadError, ///< Failed to read from file. kSDReadStatusNotShaDa, ///< Input is most likely not a ShaDa file. @@ -186,11 +186,11 @@ typedef enum { /// Possible results of shada_write function. typedef enum { - kSDWriteSuccessfull, ///< Writing was successfull. - kSDWriteReadNotShada, ///< Writing was successfull, but when reading it + kSDWriteSuccessfull, ///< Writing was successful. + kSDWriteReadNotShada, ///< Writing was successful, but when reading it ///< attempted to read file that did not look like ///< a ShaDa file. - kSDWriteFailed, ///< Writing was not successfull (e.g. because there + kSDWriteFailed, ///< Writing was not successful (e.g. because there ///< was no space left on device). kSDWriteIgnError, ///< Writing resulted in a error which can be ignored ///< (e.g. when trying to dump a function reference or @@ -3005,7 +3005,7 @@ shada_write_exit: /// location is used. /// @param[in] nomerge If true then old file is ignored. /// -/// @return OK if writing was successfull, FAIL otherwise. +/// @return OK if writing was successful, FAIL otherwise. int shada_write_file(const char *const file, bool nomerge) { if (shada_disabled()) { @@ -3341,7 +3341,7 @@ static ShaDaReadResult fread_len(ShaDaReadDef *const sd_reader, /// @param[in] sd_reader Structure containing file reader definition. /// @param[out] result Location where result is saved. /// -/// @return kSDReadStatusSuccess if reading was successfull, +/// @return kSDReadStatusSuccess if reading was successful, /// kSDReadStatusNotShaDa if there were not enough bytes to read or /// kSDReadStatusReadError if reading failed for whatever reason. static ShaDaReadResult msgpack_read_uint64(ShaDaReadDef *const sd_reader, -- cgit From 9fc3949841817921a14fa64ae3d657c936acdfc4 Mon Sep 17 00:00:00 2001 From: erw7 Date: Sun, 7 Jun 2020 01:31:23 +0900 Subject: shada: fix write E5004 error on exit Fix the problem of failing to write shada when the global variable contains Funcref or Partial. --- src/nvim/shada.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/nvim/shada.c') diff --git a/src/nvim/shada.c b/src/nvim/shada.c index 19a14f340b..3b08c8a184 100644 --- a/src/nvim/shada.c +++ b/src/nvim/shada.c @@ -2676,6 +2676,13 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer, if (name == NULL) { break; } + switch (vartv.v_type) { + case VAR_FUNC: + case VAR_PARTIAL: + continue; + default: + break; + } typval_T tgttv; tv_copy(&vartv, &tgttv); ShaDaWriteResult spe_ret; -- cgit From f1cbd39f7b12d2f7a2a528dbd034bacfe72809d2 Mon Sep 17 00:00:00 2001 From: erw7 Date: Sun, 7 Jun 2020 02:00:49 +0900 Subject: vim-patch:8.2.0920: writing viminfo fails with a circular reference Problem: Writing viminfo fails with a circular reference. Solution: Use copyID to detect the cycle. (closes vim/vim#6217) https://github.com/vim/vim/commit/5b157fe2edfdce5f77080aeac2b4a03f39eb1c1a --- src/nvim/shada.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/nvim/shada.c') diff --git a/src/nvim/shada.c b/src/nvim/shada.c index 3b08c8a184..95257fe945 100644 --- a/src/nvim/shada.c +++ b/src/nvim/shada.c @@ -2679,7 +2679,30 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer, switch (vartv.v_type) { case VAR_FUNC: case VAR_PARTIAL: + tv_clear(&vartv); continue; + case VAR_DICT: + { + dict_T *di = vartv.vval.v_dict; + int copyID = get_copyID(); + if (!set_ref_in_ht(&di->dv_hashtab, copyID, NULL) + && copyID == di->dv_copyID) { + tv_clear(&vartv); + continue; + } + break; + } + case VAR_LIST: + { + list_T *l = vartv.vval.v_list; + int copyID = get_copyID(); + if (!set_ref_in_list(l, copyID, NULL) + && copyID == l->lv_copyID) { + tv_clear(&vartv); + continue; + } + break; + } default: break; } -- cgit From a4fe8bdc97c9313eb4543427cde75c54f7be8895 Mon Sep 17 00:00:00 2001 From: erw7 Date: Fri, 31 Jul 2020 23:08:34 +0900 Subject: shada: fix failed assertion on exit (#12692) If set the number of history saves is 0, assertions fail when inserting an entry on exit. Dont insert an entry when the number of saves is 0 fixes the issue. fixes #11497 --- src/nvim/shada.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/nvim/shada.c') diff --git a/src/nvim/shada.c b/src/nvim/shada.c index 95257fe945..aa19d1db1f 100644 --- a/src/nvim/shada.c +++ b/src/nvim/shada.c @@ -2207,8 +2207,12 @@ static inline ShaDaWriteResult shada_read_when_writing( shada_free_shada_entry(&entry); break; } - hms_insert(&wms->hms[entry.data.history_item.histtype], entry, true, - true); + if (wms->hms[entry.data.history_item.histtype].hmll.size != 0) { + hms_insert(&wms->hms[entry.data.history_item.histtype], entry, true, + true); + } else { + shada_free_shada_entry(&entry); + } break; } case kSDItemRegister: { -- cgit