diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-01-26 14:33:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-26 14:33:03 +0100 |
commit | 59fd0c4132f06a76c460f46ec93fce7b7f1d6f08 (patch) | |
tree | 0a6eaf861fa7406c9cd06ffd61dc37e84b051975 /src/nvim/edit.c | |
parent | f78982620a48dc76bbd3635300650d06ced24aab (diff) | |
download | rneovim-59fd0c4132f06a76c460f46ec93fce7b7f1d6f08.tar.gz rneovim-59fd0c4132f06a76c460f46ec93fce7b7f1d6f08.tar.bz2 rneovim-59fd0c4132f06a76c460f46ec93fce7b7f1d6f08.zip |
refactor: Remove strncpy/STRNCPY. (#6008)
Closes #731
References #851
Note: This does not remove some intentional legacy usages of strncpy.
- memcpy isn't equivalent because it doesn't check the string
length of `src`, and doesn't zero-out the remainder of `dst`.
- xstrlcpy isn't equivalent because it doesn't zero-out the
remainder of `dst`. Some Vim logic depends on that (e.g.
ex_append which calls vim_strnsave).
Helped-by: Douglas Schneider <ds3@ualberta.ca>
Helped-by: oni-link <knil.ino@gmail.com>
Helped-by: James McCoy <jamessan@jamessan.com>
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r-- | src/nvim/edit.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index bb946337b5..95c33916f1 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -3847,13 +3847,11 @@ static int ins_compl_get_exp(pos_T *ini) if ((compl_cont_status & CONT_ADDING) && len == compl_length) { if (pos->lnum < ins_buf->b_ml.ml_line_count) { - /* Try next line, if any. the new word will be - * "join" as if the normal command "J" was used. - * IOSIZE is always greater than - * compl_length, so the next STRNCPY always - * works -- Acevedo */ + // Try next line, if any. the new word will be "join" as if the + // normal command "J" was used. IOSIZE is always greater than + // compl_length, so the next STRNCPY always works -- Acevedo STRNCPY(IObuff, ptr, len); - ptr = ml_get_buf(ins_buf, pos->lnum + 1, FALSE); + ptr = ml_get_buf(ins_buf, pos->lnum + 1, false); tmp_ptr = ptr = skipwhite(ptr); /* Find start of next word. */ tmp_ptr = find_word_start(tmp_ptr); |