aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ops.c
diff options
context:
space:
mode:
authorScott Prager <splinterofchaos@gmail.com>2014-09-05 04:25:34 -0400
committerScott Prager <splinterofchaos@gmail.com>2014-09-30 19:33:48 -0400
commiteff839b26df8b10b2334e2fbdaf81fbb3236b873 (patch)
tree04bd665543f461c09a9bb5b75bde2deccf588b84 /src/nvim/ops.c
parentafe7ba1e71f0fe43817ae9abac56c721c99f95c6 (diff)
downloadrneovim-eff839b26df8b10b2334e2fbdaf81fbb3236b873.tar.gz
rneovim-eff839b26df8b10b2334e2fbdaf81fbb3236b873.tar.bz2
rneovim-eff839b26df8b10b2334e2fbdaf81fbb3236b873.zip
memory: xstrchrnul and xmemscan.
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r--src/nvim/ops.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 9b98c84be4..2067d863eb 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -4903,10 +4903,9 @@ static void str_to_reg(struct yankreg *y_ptr,
* Find the end of each line and save it into the array.
*/
for (start = 0; start < len + extraline; start += i + 1) {
- for (i = start; i < len; ++i) /* find the end of the line */
- if (str[i] == '\n')
- break;
- i -= start; /* i is now length of line */
+ // Let i represent the length of one line.
+ const char_u *p = str + start;
+ i = (char_u *)xmemscan(p, '\n', len - start) - p;
if (i > maxlen)
maxlen = i;
if (append) {