aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/macros.h
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-01-04 18:45:10 +0300
committerZyX <kp-pav@yandex.ru>2018-03-26 00:38:29 +0300
commit607e0d2202053a2db290f00d99364f4895917f39 (patch)
tree87b88c8ae82d0783670605e73b48f66fd96ff87f /src/nvim/macros.h
parenta9c94f7bb05c53b1c81ec7e65f5df86947c12c58 (diff)
downloadrneovim-607e0d2202053a2db290f00d99364f4895917f39.tar.gz
rneovim-607e0d2202053a2db290f00d99364f4895917f39.tar.bz2
rneovim-607e0d2202053a2db290f00d99364f4895917f39.zip
shada: Save numbered marks
Problems so far: - Marks in the current instance are not adjusted. - Duplicates are not removed (not that it works in Vim either now, not at 8.0.134 at least).
Diffstat (limited to 'src/nvim/macros.h')
-rw-r--r--src/nvim/macros.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/nvim/macros.h b/src/nvim/macros.h
index 4e01265498..e802ba2aed 100644
--- a/src/nvim/macros.h
+++ b/src/nvim/macros.h
@@ -136,13 +136,21 @@
# define RESET_BINDING(wp) (wp)->w_p_scb = FALSE; (wp)->w_p_crb = FALSE
-/// Calculate the length of a C array.
+/// Calculate the length of a C array
///
/// This should be called with a real array. Calling this with a pointer is an
-/// error. A mechanism to detect many (though not all) of those errors at compile
-/// time is implemented. It works by the second division producing a division by
-/// zero in those cases (-Wdiv-by-zero in GCC).
-#define ARRAY_SIZE(arr) ((sizeof(arr)/sizeof((arr)[0])) / ((size_t)(!(sizeof(arr) % sizeof((arr)[0])))))
+/// error. A mechanism to detect many (though not all) of those errors at
+/// compile time is implemented. It works by the second division producing
+/// a division by zero in those cases (-Wdiv-by-zero in GCC).
+#define ARRAY_SIZE(arr) \
+ ((sizeof(arr)/sizeof((arr)[0])) \
+ / ((size_t)(!(sizeof(arr) % sizeof((arr)[0])))))
+
+/// Get last array entry
+///
+/// This should be called with a real array. Calling this with a pointer is an
+/// error.
+#define LAST_ARRAY_ENTRY(arr) (arr)[ARRAY_SIZE(arr) - 1]
// Duplicated in os/win_defs.h to avoid include-order sensitivity.
#define RGB_(r, g, b) ((r << 16) | (g << 8) | b)