Merge pull request #15934 from kylo252/replacement-size

fix(lint): remove redundant ternary operator
This commit is contained in:
Björn Linse 2021-10-07 18:57:48 +02:00 committed by GitHub
commit b9a35ec7a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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++) {