aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-01-23 14:34:47 +0100
committerJustin M. Keyes <justinkz@gmail.com>2017-01-23 15:49:37 +0100
commit7e799b6e910880d37e47c86ac46f12ce1c1c8a25 (patch)
treec226e6752ecbf97a2a42a42555b0fe8f79ec0439 /src
parent6c467f3f7e71029c6ef4b8a18d8900ff51eb1174 (diff)
downloadrneovim-7e799b6e910880d37e47c86ac46f12ce1c1c8a25.tar.gz
rneovim-7e799b6e910880d37e47c86ac46f12ce1c1c8a25.tar.bz2
rneovim-7e799b6e910880d37e47c86ac46f12ce1c1c8a25.zip
refactor: Replace vim_strcat() with xstrlcat().
Diffstat (limited to 'src')
-rw-r--r--src/nvim/hardcopy.c4
-rw-r--r--src/nvim/misc1.c5
-rw-r--r--src/nvim/quickfix.c2
-rw-r--r--src/nvim/strings.c18
-rw-r--r--src/nvim/syntax.c4
5 files changed, 8 insertions, 25 deletions
diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c
index cb0415a486..c2dc6231f1 100644
--- a/src/nvim/hardcopy.c
+++ b/src/nvim/hardcopy.c
@@ -1544,8 +1544,8 @@ static int prt_find_resource(char *name, struct prt_ps_resource_S *resource)
/* Look for named resource file in runtimepath */
STRCPY(buffer, "print");
add_pathsep((char *)buffer);
- vim_strcat(buffer, (char_u *)name, MAXPATHL);
- vim_strcat(buffer, (char_u *)".ps", MAXPATHL);
+ xstrlcat((char *)buffer, name, MAXPATHL);
+ xstrlcat((char *)buffer, ".ps", MAXPATHL);
resource->filename[0] = NUL;
retval = (do_in_runtimepath(buffer, 0, prt_resource_name, resource->filename)
&& resource->filename[0] != NUL);
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c
index 71aa6e83e5..ba26381e23 100644
--- a/src/nvim/misc1.c
+++ b/src/nvim/misc1.c
@@ -2507,8 +2507,9 @@ void msgmore(long n)
vim_snprintf((char *)msg_buf, MSG_BUF_LEN,
_("%" PRId64 " fewer lines"), (int64_t)pn);
}
- if (got_int)
- vim_strcat(msg_buf, (char_u *)_(" (Interrupted)"), MSG_BUF_LEN);
+ if (got_int) {
+ xstrlcat((char *)msg_buf, _(" (Interrupted)"), MSG_BUF_LEN);
+ }
if (msg(msg_buf)) {
set_keep_msg(msg_buf, 0);
keep_msg_more = TRUE;
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index 19287ecffb..cebff5e8b7 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -2126,7 +2126,7 @@ static void qf_msg(qf_info_T *qi, int which, char *lead)
memset(buf + len, ' ', 34 - len);
buf[34] = NUL;
}
- vim_strcat(buf, (char_u *)title, IOSIZE);
+ xstrlcat((char *)buf, title, IOSIZE);
}
trunc_string(buf, buf, (int)Columns - 1, IOSIZE);
msg(buf);
diff --git a/src/nvim/strings.c b/src/nvim/strings.c
index c1800a0639..5b4f23f30e 100644
--- a/src/nvim/strings.c
+++ b/src/nvim/strings.c
@@ -344,24 +344,6 @@ void del_trailing_spaces(char_u *ptr)
*q = NUL;
}
-/*
- * Like strcat(), but make sure the result fits in "tosize" bytes and is
- * always NUL terminated.
- */
-void vim_strcat(char_u *restrict to, const char_u *restrict from,
- size_t tosize)
- FUNC_ATTR_NONNULL_ALL
-{
- size_t tolen = STRLEN(to);
- size_t fromlen = STRLEN(from);
-
- if (tolen + fromlen + 1 > tosize) {
- memcpy(to + tolen, from, tosize - tolen - 1);
- to[tosize - 1] = NUL;
- } else
- STRCPY(to + tolen, from);
-}
-
#if (!defined(HAVE_STRCASECMP) && !defined(HAVE_STRICMP))
/*
* Compare two strings, ignoring case, using current locale.
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index aded08faee..5bfc655645 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -6902,8 +6902,8 @@ static int highlight_list_arg(int id, int didh, int type, int iarg, char_u *sarg
for (i = 0; hl_attr_table[i] != 0; ++i) {
if (iarg & hl_attr_table[i]) {
if (buf[0] != NUL)
- vim_strcat(buf, (char_u *)",", 100);
- vim_strcat(buf, (char_u *)hl_name_table[i], 100);
+ xstrlcat((char *)buf, ",", 100);
+ xstrlcat((char *)buf, hl_name_table[i], 100);
iarg &= ~hl_attr_table[i]; /* don't want "inverse" */
}
}