tweaks: don't bother to reallocate when the keybuffer size decreases

It will be reallocated soon enough when the size increases again.
master
Benno Schulenberg 2018-01-15 19:46:16 +01:00
parent 4c7ec18a55
commit 90cf4838d2
1 changed files with 1 additions and 4 deletions

View File

@ -316,12 +316,9 @@ int *get_input(WINDOW *win, size_t input_len)
key_buffer_len -= input_len;
/* If the buffer still contains keystrokes, move them to the front. */
if (key_buffer_len > 0) {
if (key_buffer_len > 0)
memmove(key_buffer, key_buffer + input_len, key_buffer_len *
sizeof(int));
key_buffer = (int *)nrealloc(key_buffer, key_buffer_len *
sizeof(int));
}
return input;
}