aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/path.c2
-rw-r--r--src/nvim/runtime.c7
-rw-r--r--src/nvim/strings.c19
3 files changed, 5 insertions, 23 deletions
diff --git a/src/nvim/path.c b/src/nvim/path.c
index 828b690699..d1e0947038 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -1810,7 +1810,7 @@ bool path_with_extension(const char *path, const char *extension)
if (!last_dot) {
return false;
}
- return strcmp(last_dot + 1, extension) == 0;
+ return mb_strcmp_ic((bool)p_fic, last_dot + 1, extension) == 0;
}
/// Return true if "name" is a full (absolute) path name or URL.
diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c
index 9cd4a17b27..9614937c4c 100644
--- a/src/nvim/runtime.c
+++ b/src/nvim/runtime.c
@@ -275,7 +275,7 @@ static bool source_callback_vim_lua(int num_fnames, char **fnames, bool all, voi
bool did_one = false;
for (int i = 0; i < num_fnames; i++) {
- if (str_ends_with(fnames[i], ".vim")) {
+ if (path_with_extension(fnames[i], "vim")) {
(void)do_source(fnames[i], false, DOSO_NONE, cookie);
did_one = true;
if (!all) {
@@ -285,7 +285,7 @@ static bool source_callback_vim_lua(int num_fnames, char **fnames, bool all, voi
}
for (int i = 0; i < num_fnames; i++) {
- if (str_ends_with(fnames[i], ".lua")) {
+ if (path_with_extension(fnames[i], "lua")) {
(void)do_source(fnames[i], false, DOSO_NONE, cookie);
did_one = true;
if (!all) {
@@ -308,7 +308,8 @@ static bool source_callback(int num_fnames, char **fnames, bool all, void *cooki
}
for (int i = 0; i < num_fnames; i++) {
- if (!str_ends_with(fnames[i], ".vim") && !str_ends_with(fnames[i], ".lua")) {
+ if (!path_with_extension(fnames[i], "vim")
+ && !path_with_extension(fnames[i], "lua")) {
(void)do_source(fnames[i], false, DOSO_NONE, cookie);
did_one = true;
if (!all) {
diff --git a/src/nvim/strings.c b/src/nvim/strings.c
index 52a803a3cc..6fe2fd8ff3 100644
--- a/src/nvim/strings.c
+++ b/src/nvim/strings.c
@@ -436,25 +436,6 @@ char *vim_strchr(const char *const string, const int c)
}
}
-/// Test if "str" ends with "suffix"
-///
-/// @param[in] str
-/// @param[in] suffix to match
-///
-/// @return [allocated] Copy of the string.
-bool str_ends_with(const char *str, const char *suffix)
-{
- if (!str || !suffix) {
- return false;
- }
- size_t lenstr = strlen(str);
- size_t lensuffix = strlen(suffix);
- if (lensuffix > lenstr) {
- return false;
- }
- return strncmp(str + lenstr - lensuffix, suffix, lensuffix) == 0;
-}
-
// Sort an array of strings.
#ifdef INCLUDE_GENERATED_DECLARATIONS