fix(lint): remove redundant ternary operator

The value of `new_len` will never be '0' since `replacement.size`
is checked against that early on.
This commit is contained in:
kylo252 2021-10-06 18:21:41 +02:00
parent a161559a00
commit 47dd6c4f47

View File

@ -624,7 +624,8 @@ void nvim_buf_set_text(uint64_t channel_id, Buffer buffer, Integer start_row, In
if (replacement.size == 1) {
firstlen += last_part_len;
}
char *first = xmallocz(firstlen), *last = NULL;
char *first = xmallocz(firstlen);
char *last = NULL;
memcpy(first, str_at_start, (size_t)start_col);
memcpy(first+start_col, first_item.data, first_item.size);
memchrsub(first+start_col, NUL, NL, first_item.size);
@ -637,7 +638,7 @@ void nvim_buf_set_text(uint64_t channel_id, Buffer buffer, Integer start_row, In
memcpy(last+last_item.size, str_at_end+end_col, last_part_len);
}
char **lines = (new_len != 0) ? xcalloc(new_len, sizeof(char *)) : NULL;
char **lines = xcalloc(new_len, sizeof(char *));
lines[0] = first;
new_byte += (bcount_t)(first_item.size);
for (size_t i = 1; i < new_len-1; i++) {