aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMark Bainter <mbainter+github@gmail.com>2015-04-12 14:48:02 +0000
committerJustin M. Keyes <justinkz@gmail.com>2015-04-12 16:13:22 -0400
commit917ba54ff5660f91b862c44bb5656a3cc520187b (patch)
tree256cb16e8a85ffc99609986c213cc17b70ed3273 /src
parente129e2792da32c667657f2e21a97e65f847a6ed7 (diff)
downloadrneovim-917ba54ff5660f91b862c44bb5656a3cc520187b.tar.gz
rneovim-917ba54ff5660f91b862c44bb5656a3cc520187b.tar.bz2
rneovim-917ba54ff5660f91b862c44bb5656a3cc520187b.zip
refactor remove_tail() function to no longer use char_u #2413
See #459
Diffstat (limited to 'src')
-rw-r--r--src/nvim/os/env.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c
index 52c3e0d9cd..546f263187 100644
--- a/src/nvim/os/env.c
+++ b/src/nvim/os/env.c
@@ -390,14 +390,14 @@ static char_u *vim_version_dir(char_u *vimdir)
/// If the string between "p" and "pend" ends in "name/", return "pend" minus
/// the length of "name/". Otherwise return "pend".
-static char_u *remove_tail(char_u *p, char_u *pend, char_u *name)
+static char *remove_tail(char *p, char *pend, char *name)
{
- int len = (int)STRLEN(name) + 1;
- char_u *newend = pend - len;
+ size_t len = STRLEN(name) + 1;
+ char *newend = pend - len;
if (newend >= p
- && fnamencmp(newend, name, len - 1) == 0
- && (newend == p || after_pathsep(p, newend)))
+ && fnamencmp((char_u *)newend, (char_u *)name, len - 1) == 0
+ && (newend == p || after_pathsep((char_u *)p, (char_u *)newend)))
return newend;
return pend;
}
@@ -464,12 +464,14 @@ char_u *vim_getenv(char_u *name, bool *mustfree)
/* remove "doc/" from 'helpfile', if present */
if (p == p_hf)
- pend = remove_tail(p, pend, (char_u *)"doc");
+ pend = (char_u *)remove_tail((char *)p, (char *)pend, "doc");
/* for $VIM, remove "runtime/" or "vim54/", if present */
if (!vimruntime) {
- pend = remove_tail(p, pend, (char_u *)RUNTIME_DIRNAME);
- pend = remove_tail(p, pend, (char_u *)VIM_VERSION_NODOT);
+ pend = (char_u *)remove_tail((char *)p, (char *)pend,
+ RUNTIME_DIRNAME);
+ pend = (char_u *)remove_tail((char *)p, (char *)pend,
+ VIM_VERSION_NODOT);
}
/* remove trailing path separator */