summaryrefslogtreecommitdiff
path: root/src/mbyte.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-08-29 22:25:38 +0000
committerBram Moolenaar <Bram@vim.org>2005-08-29 22:25:38 +0000
commitac6e65f88da446bc764ff13a23d854fd72ffedcf (patch)
tree4c4cd8700dcb53ac3a236a056320e2caf062a23d /src/mbyte.c
parent81f1ecbc4dc885a4757e5cc64002f4b22f397f18 (diff)
downloadvim-ac6e65f88da446bc764ff13a23d854fd72ffedcf.zip
updated for version 7.0138
Diffstat (limited to 'src/mbyte.c')
-rw-r--r--src/mbyte.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/mbyte.c b/src/mbyte.c
index 9f2df3ad4..d446a5b41 100644
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -2706,17 +2706,37 @@ mb_prevptr(line, p)
mb_charlen(str)
char_u *str;
{
- int count;
+ char_u *p = str;
+ int count;
- if (str == NULL)
+ if (p == NULL)
return 0;
- for (count = 0; *str != NUL; count++)
- str += (*mb_ptr2len)(str);
+ for (count = 0; *p != NUL; count++)
+ p += (*mb_ptr2len)(p);
return count;
}
+#if defined(FEAT_SYN_HL) || defined(PROTO)
+/*
+ * Like mb_charlen() but for a string with specified length.
+ */
+ int
+mb_charlen_len(str, len)
+ char_u *str;
+ int len;
+{
+ char_u *p = str;
+ int count;
+
+ for (count = 0; *p != NUL && p < str + len; count++)
+ p += (*mb_ptr2len)(p);
+
+ return count;
+}
+#endif
+
/*
* Try to un-escape a multi-byte character.
* Used for the "to" and "from" part of a mapping.