diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-04-02 12:01:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-02 12:01:00 +0200 |
commit | 0c59ac1a2c7ee6ca2b03efa1013a1db0b4fcda61 (patch) | |
tree | 52ab90af627d51d0c73d53e7c03f80e82d8accbe /src/nvim/macros.h | |
parent | 4b26e365aed364a62dd1535ee04fea9f458afe81 (diff) | |
parent | 5d9bb16d66043f10dc14435c0594ca6f31b1795f (diff) | |
download | rneovim-0c59ac1a2c7ee6ca2b03efa1013a1db0b4fcda61.tar.gz rneovim-0c59ac1a2c7ee6ca2b03efa1013a1db0b4fcda61.tar.bz2 rneovim-0c59ac1a2c7ee6ca2b03efa1013a1db0b4fcda61.zip |
Merge #5908 'shada: Also save numbered marks'
Diffstat (limited to 'src/nvim/macros.h')
-rw-r--r-- | src/nvim/macros.h | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/nvim/macros.h b/src/nvim/macros.h index 4e01265498..348df2d9b6 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 ARRAY_LAST_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) |