aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-04-03 02:03:05 +0300
committerZyX <kp-pav@yandex.ru>2017-04-03 02:03:05 +0300
commit5dcf2804455f45eac8aad7d900bf60464a4b2888 (patch)
treea96301ec0356c126da4daf11173e191d295adfd8 /src/nvim/os
parent1c41b9c77552618a5010ca69bee92033c4082748 (diff)
downloadrneovim-5dcf2804455f45eac8aad7d900bf60464a4b2888.tar.gz
rneovim-5dcf2804455f45eac8aad7d900bf60464a4b2888.tar.bz2
rneovim-5dcf2804455f45eac8aad7d900bf60464a4b2888.zip
fileio: Refactor msg_add_fname to something which needs no comments
Diffstat (limited to 'src/nvim/os')
-rw-r--r--src/nvim/os/env.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c
index a10c835591..1a97adfa21 100644
--- a/src/nvim/os/env.c
+++ b/src/nvim/os/env.c
@@ -703,7 +703,8 @@ char *vim_getenv(const char *name)
/// @param dstlen Maximum length of the result
/// @param one If true, only replace one file name, including spaces and commas
/// in the file name
-void home_replace(buf_T *buf, char_u *src, char_u *dst, int dstlen, bool one)
+void home_replace(const buf_T *const buf, const char_u *src,
+ char_u *dst, size_t dstlen, bool one)
{
size_t dirlen = 0, envlen = 0;
size_t len;
@@ -717,7 +718,7 @@ void home_replace(buf_T *buf, char_u *src, char_u *dst, int dstlen, bool one)
* If the file is a help file, remove the path completely.
*/
if (buf != NULL && buf->b_help) {
- STRCPY(dst, path_tail(src));
+ xstrlcpy((char *)dst, (char *)path_tail(src), dstlen);
return;
}
@@ -809,7 +810,7 @@ char_u * home_replace_save(buf_T *buf, char_u *src) FUNC_ATTR_NONNULL_RET
len += STRLEN(src);
}
char_u *dst = xmalloc(len);
- home_replace(buf, src, dst, (int)len, true);
+ home_replace(buf, src, dst, len, true);
return dst;
}