aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Schneider <ds3@ualberta.ca>2014-05-29 08:20:11 -0600
committerJustin M. Keyes <justinkz@gmail.com>2014-06-13 18:08:21 -0400
commit43f5a5ef656fbae0c832808d8bca87fd49ceaf08 (patch)
treedb1f06b906248e6e8f14c967e0d6fc307c9acf0b
parent1a1725765c8815e7f55687771c95a6e4590e312c (diff)
downloadrneovim-43f5a5ef656fbae0c832808d8bca87fd49ceaf08.tar.gz
rneovim-43f5a5ef656fbae0c832808d8bca87fd49ceaf08.tar.bz2
rneovim-43f5a5ef656fbae0c832808d8bca87fd49ceaf08.zip
Replace vim_strncpy calls: tag.c
-rw-r--r--src/nvim/tag.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/nvim/tag.c b/src/nvim/tag.c
index 5ab5e198bf..40611bd237 100644
--- a/src/nvim/tag.c
+++ b/src/nvim/tag.c
@@ -698,12 +698,11 @@ do_tag (
len = (int)(tagp.tagname_end - tagp.tagname);
if (len > 128)
len = 128;
- vim_strncpy(tag_name, tagp.tagname, len);
- tag_name[len] = NUL;
+ STRLCPY(tag_name, tagp.tagname, len + 1);
/* Save the tag file name */
p = tag_full_fname(&tagp);
- vim_strncpy(fname, p, MAXPATHL);
+ STRLCPY(fname, p, MAXPATHL + 1);
free(p);
/*
@@ -1827,7 +1826,7 @@ parse_line:
mfp = xmalloc(sizeof(struct match_found) + len);
mfp->len = len + 1; /* include the NUL */
p = mfp->match;
- vim_strncpy(p, tagp.command + 2, len);
+ STRLCPY(p, tagp.command + 2, len + 1);
} else
mfp = NULL;
get_it_again = FALSE;
@@ -1836,7 +1835,7 @@ parse_line:
mfp = xmalloc(sizeof(struct match_found) + len);
mfp->len = len + 1; /* include the NUL */
p = mfp->match;
- vim_strncpy(p, tagp.tagname, len);
+ STRLCPY(p, tagp.tagname, len + 1);
/* if wanted, re-read line to get long form too */
if (State & INSERT)
@@ -2058,8 +2057,8 @@ get_tagfname (
STRCPY(buf, p_hf);
STRCPY(path_tail(buf), "tags");
} else
- vim_strncpy(buf, ((char_u **)(tag_fnames.ga_data))[
- tnp->tn_hf_idx++], MAXPATHL - 1);
+ STRLCPY(buf, ((char_u **)(tag_fnames.ga_data))[
+ tnp->tn_hf_idx++], MAXPATHL);
return OK;
}
@@ -2636,8 +2635,8 @@ static char_u *expand_tag_fname(char_u *fname, char_u *tag_fname, int expand)
&& (p = path_tail(tag_fname)) != tag_fname) {
retval = xmalloc(MAXPATHL);
STRCPY(retval, tag_fname);
- vim_strncpy(retval + (p - tag_fname), fname,
- MAXPATHL - (p - tag_fname) - 1);
+ STRLCPY(retval + (p - tag_fname), fname,
+ MAXPATHL - (p - tag_fname));
/*
* Translate names like "src/a/../b/file.c" into "src/b/file.c".
*/
@@ -2791,7 +2790,7 @@ add_tag_field (
len = (int)(end - start);
if (len > MAXPATHL - 1)
len = MAXPATHL - 1;
- vim_strncpy(buf, start, len);
+ STRLCPY(buf, start, len + 1);
}
buf[len] = NUL;
retval = dict_add_nr_str(dict, field_name, 0L, buf);