diff options
Diffstat (limited to 'src/nvim/runtime.c')
-rw-r--r-- | src/nvim/runtime.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c index 5ade6244f9..674d807e96 100644 --- a/src/nvim/runtime.c +++ b/src/nvim/runtime.c @@ -146,7 +146,7 @@ int do_in_path(char_u *path, char *name, int flags, DoInRuntimepathCB callback, char *basepath = path == p_rtp ? "runtimepath" : "packpath"; if (flags & DIP_ERR) { - EMSG3(_(e_dirnotf), basepath, name); + semsg(_(e_dirnotf), basepath, name); } else if (p_verbose > 0) { verbose_enter(); smsg(_("not found in '%s': \"%s\""), basepath, name); @@ -268,7 +268,7 @@ int do_in_cached_path(char_u *name, int flags, DoInRuntimepathCB callback, void if (!did_one && name != NULL) { if (flags & DIP_ERR) { - EMSG3(_(e_dirnotf), "runtime path", name); + semsg(_(e_dirnotf), "runtime path", name); } else if (p_verbose > 0) { verbose_enter(); smsg(_("not found in runtime path: \"%s\""), name); @@ -439,16 +439,16 @@ static void expand_rtp_entry(RuntimeSearchPath *search_path, Map(String, handle_ } static void expand_pack_entry(RuntimeSearchPath *search_path, Map(String, handle_T) *rtp_used, - CharVec *after_path, char_u *pack_entry) + CharVec *after_path, char_u *pack_entry, size_t pack_entry_len) { static char buf[MAXPATHL]; char *(start_pat[]) = { "/pack/*/start/*", "/start/*" }; // NOLINT for (int i = 0; i < 2; i++) { - if (STRLEN(pack_entry) + STRLEN(start_pat[i]) + 1 > MAXPATHL) { + if (pack_entry_len + STRLEN(start_pat[i]) + 1 > sizeof buf) { continue; } - STRLCPY(buf, pack_entry, MAXPATHL); - xstrlcat(buf, start_pat[i], sizeof buf); + STRLCPY(buf, pack_entry, sizeof buf); + STRLCPY(buf + pack_entry_len, start_pat[i], sizeof buf - pack_entry_len); expand_rtp_entry(search_path, rtp_used, buf, false); size_t after_size = STRLEN(buf)+7; char *after = xmallocz(after_size); @@ -507,14 +507,15 @@ RuntimeSearchPath runtime_search_path_build(void) handle_T *h = map_ref(String, handle_T)(&pack_used, cstr_as_string((char *)buf), false); if (h) { (*h)++; - expand_pack_entry(&search_path, &rtp_used, &after_path, buf); + expand_pack_entry(&search_path, &rtp_used, &after_path, buf, buflen); } } for (size_t i = 0; i < kv_size(pack_entries); i++) { - handle_T h = map_get(String, handle_T)(&pack_used, kv_A(pack_entries, i)); + String item = kv_A(pack_entries, i); + handle_T h = map_get(String, handle_T)(&pack_used, item); if (h == 0) { - expand_pack_entry(&search_path, &rtp_used, &after_path, (char_u *)kv_A(pack_entries, i).data); + expand_pack_entry(&search_path, &rtp_used, &after_path, (char_u *)item.data, item.size); } } @@ -573,7 +574,6 @@ void runtime_search_path_validate(void) } - /// Just like do_in_path_and_pp(), using 'runtimepath' for "path". int do_in_runtimepath(char_u *name, int flags, DoInRuntimepathCB callback, void *cookie) { |