summaryrefslogtreecommitdiff
path: root/src/macros.h
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-10-06 22:00:13 +0200
committerBram Moolenaar <Bram@vim.org>2019-10-06 22:00:13 +0200
commit1614a14901558ca091329315d14a7d5e1b53aa47 (patch)
tree324ceeba0f8d5bda2f270b591a1beeed8e74125d /src/macros.h
parent524f3b19ae16e08350010b5effe38d0637349285 (diff)
downloadvim-git-1614a14901558ca091329315d14a7d5e1b53aa47.tar.gz
patch 8.1.2120: some MB_ macros are more complicated than necessaryv8.1.2120
Problem: Some MB_ macros are more complicated than necessary. (Dominique Pelle) Solution: Simplify the macros. Expand inline.
Diffstat (limited to 'src/macros.h')
-rw-r--r--src/macros.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/macros.h b/src/macros.h
index 5e047c873..f670046b3 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -229,12 +229,10 @@
* MB_COPY_CHAR(f, t): copy one char from "f" to "t" and advance the pointers.
* PTR2CHAR(): get character from pointer.
*/
-/* Get the length of the character p points to, including composing chars */
-#define MB_PTR2LEN(p) (has_mbyte ? (*mb_ptr2len)(p) : (*p == NUL ? 0 : 1))
/* Advance multi-byte pointer, skip over composing chars. */
-#define MB_PTR_ADV(p) p += has_mbyte ? (*mb_ptr2len)(p) : (*p == NUL ? 0 : 1)
+#define MB_PTR_ADV(p) p += (*mb_ptr2len)(p)
/* Advance multi-byte pointer, do not skip over composing chars. */
-#define MB_CPTR_ADV(p) p += enc_utf8 ? utf_ptr2len(p) : has_mbyte ? (*mb_ptr2len)(p) : (*p == NUL ? 0 : 1)
+#define MB_CPTR_ADV(p) p += enc_utf8 ? utf_ptr2len(p) : (*mb_ptr2len)(p)
/* Backup multi-byte pointer. Only use with "p" > "s" ! */
#define MB_PTR_BACK(s, p) p -= has_mbyte ? ((*mb_head_off)(s, p - 1) + 1) : 1
/* get length of multi-byte char, not including composing chars */