diff options
author | Ihor Antonov <ngortheone@users.noreply.github.com> | 2019-07-16 08:32:09 -0400 |
---|---|---|
committer | Ihor Antonov <ngortheone@users.noreply.github.com> | 2019-07-16 08:32:09 -0400 |
commit | 96e87c5a63b84df443a67d35e838703108959873 (patch) | |
tree | c1f632a026f33a140a88f0833b717f0a507e4013 /src | |
parent | 6262d82d2fb70094fc8e6876d05a6efba798d3bf (diff) | |
download | rneovim-96e87c5a63b84df443a67d35e838703108959873.tar.gz rneovim-96e87c5a63b84df443a67d35e838703108959873.tar.bz2 rneovim-96e87c5a63b84df443a67d35e838703108959873.zip |
lint
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/misc1.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index cb6643f6cc..5a5bd16b98 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -495,13 +495,13 @@ open_line ( } if (lead_len > 0) { // allocate buffer (may concatenate p_extra later) - int bytes = lead_len - + lead_repl_len - + extra_space - + extra_len - + (second_line_indent > 0 ? second_line_indent : 0) + int bytes = lead_len + + lead_repl_len + + extra_space + + extra_len + + (second_line_indent > 0 ? second_line_indent : 0) + 1; - assert( bytes >= 0 ); + assert(bytes >= 0); leader = xmalloc((size_t)bytes); allocated = leader; // remember to free it later @@ -1561,13 +1561,14 @@ void ins_str(char_u *s) oldp = ml_get(lnum); oldlen = (int)STRLEN(oldp); - newp = (char_u *) xmalloc((size_t)oldlen + (size_t)newlen + 1); - if (col > 0) + newp = (char_u *)xmalloc((size_t)oldlen + (size_t)newlen + 1); + if (col > 0) { memmove(newp, oldp, (size_t)col); + } memmove(newp + col, s, (size_t)newlen); int bytes = oldlen - col + 1; assert(bytes >= 0); - memmove(newp + col + newlen, oldp + col, bytes); + memmove(newp + col + newlen, oldp + col, (size_t)bytes); ml_replace(lnum, newp, false); changed_bytes(lnum, col); curwin->w_cursor.col += newlen; |