mirror of
https://github.com/neovim/neovim.git
synced 2025-10-03 08:28:34 +00:00
@@ -145,7 +145,7 @@
|
|||||||
} while (0)
|
} while (0)
|
||||||
#else
|
#else
|
||||||
# define STRICT_ADD(a, b, c, t) \
|
# define STRICT_ADD(a, b, c, t) \
|
||||||
do { *(c) = (t)(a + b); } while (0)
|
do { *(c) = (t)((a) + (b)); } while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// @def STRICT_SUB
|
/// @def STRICT_SUB
|
||||||
@@ -160,7 +160,7 @@
|
|||||||
} while (0)
|
} while (0)
|
||||||
#else
|
#else
|
||||||
# define STRICT_SUB(a, b, c, t) \
|
# define STRICT_SUB(a, b, c, t) \
|
||||||
do { *(c) = (t)(a - b); } while (0)
|
do { *(c) = (t)((a) - (b)); } while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // NVIM_ASSERT_H
|
#endif // NVIM_ASSERT_H
|
||||||
|
@@ -204,13 +204,12 @@ int set_indent(int size, int flags)
|
|||||||
// characters and allocate accordingly. We will fill the rest with spaces
|
// characters and allocate accordingly. We will fill the rest with spaces
|
||||||
// after the if (!curbuf->b_p_et) below.
|
// after the if (!curbuf->b_p_et) below.
|
||||||
if (orig_char_len != -1) {
|
if (orig_char_len != -1) {
|
||||||
assert(orig_char_len + size - ind_done + line_len >= 0);
|
int newline_size; // = orig_char_len + size - ind_done + line_len
|
||||||
size_t n; // = orig_char_len + size - ind_done + line_len
|
STRICT_ADD(orig_char_len, size, &newline_size, int);
|
||||||
size_t n2;
|
STRICT_SUB(newline_size, ind_done, &newline_size, int);
|
||||||
STRICT_ADD(orig_char_len, size, &n, size_t);
|
STRICT_ADD(newline_size, line_len, &newline_size, int);
|
||||||
STRICT_ADD(ind_done, line_len, &n2, size_t);
|
assert(newline_size >= 0);
|
||||||
STRICT_SUB(n, n2, &n, size_t);
|
newline = xmalloc((size_t)newline_size);
|
||||||
newline = xmalloc(n);
|
|
||||||
todo = size - ind_done;
|
todo = size - ind_done;
|
||||||
|
|
||||||
// Set total length of indent in characters, which may have been
|
// Set total length of indent in characters, which may have been
|
||||||
|
Reference in New Issue
Block a user