Problem: byteidx_common() and f_utf16idx() are calling ptr2len() twice
per iteration, instead of reusing the already computed clen.
Solution: Reuse clen for pointer advancement in both functions
(Yasuhiro Matsumoto).
closes: #19573
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
int c = (clen > 1) ? utf_ptr2char(t) : *t;
if (c > 0xFFFF)
idx--;
+ if (idx > 0)
+ t += clen;
}
- if (idx > 0)
+ else if (idx > 0)
t += ptr2len(t);
}
rettv->vval.v_number = (varnumber_T)(t - str);
int c = (clen > 1) ? utf_ptr2char(p) : *p;
if (c > 0xFFFF)
len++;
- p += ptr2len(p);
+ p += clen;
if (charidx)
idx--;
}
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 108,
/**/
107,
/**/