aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/shada.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-10-22 13:03:02 +0800
committerGitHub <noreply@github.com>2024-10-22 13:03:02 +0800
commitca7855c5ba7025e512ffbbc060fcf928cc480c91 (patch)
treea502fab4ab227ec35397bbdbd17ceca6b14588ed /src/nvim/shada.c
parent1b9dafa67ba98e360444832e1fddce1e96acc1d6 (diff)
downloadrneovim-ca7855c5ba7025e512ffbbc060fcf928cc480c91.tar.gz
rneovim-ca7855c5ba7025e512ffbbc060fcf928cc480c91.tar.bz2
rneovim-ca7855c5ba7025e512ffbbc060fcf928cc480c91.zip
vim-patch:9.1.0798: too many strlen() calls in cmdhist.c (#30895)
Problem: too many strlen() calls in cmdhist.c Solution: refactor code and remove strlen() calls (John Marriott) closes: vim/vim#15888 https://github.com/vim/vim/commit/8df07d0ca310a55e1540f7d234b536abee49abd4 Co-authored-by: John Marriott <basilisk@internode.on.net>
Diffstat (limited to 'src/nvim/shada.c')
-rw-r--r--src/nvim/shada.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nvim/shada.c b/src/nvim/shada.c
index 27671771ec..11fe291559 100644
--- a/src/nvim/shada.c
+++ b/src/nvim/shada.c
@@ -658,7 +658,7 @@ static const void *shada_hist_iter(const void *const iter, const uint8_t history
.histtype = history_type,
.string = hist_he.hisstr,
.sep = (char)(history_type == HIST_SEARCH
- ? hist_he.hisstr[strlen(hist_he.hisstr) + 1]
+ ? hist_he.hisstr[hist_he.hisstrlen + 1]
: 0),
}
},
@@ -784,6 +784,7 @@ static inline void hms_to_he_array(const HistoryMergerState *const hms_p,
hist->timestamp = cur_entry->data.timestamp;
hist->hisnum = (int)(hist - hist_array) + 1;
hist->hisstr = cur_entry->data.data.history_item.string;
+ hist->hisstrlen = strlen(cur_entry->data.data.history_item.string);
hist->additional_data = cur_entry->data.additional_data;
hist++;
})