mirror of
https://github.com/tmux/tmux.git
synced 2025-09-07 10:27:00 +00:00
A few trivial optimisations: no need to check for zero size if calling
buffer_ensure in buffer.c; expand grid lines by a greater increase than one each time; and don't read UTF-8 data unless it actually needs to be checked when overwriting a cell.
This commit is contained in:
5
buffer.c
5
buffer.c
@ -100,9 +100,6 @@ buffer_remove(struct buffer *b, size_t size)
|
||||
void
|
||||
buffer_write(struct buffer *b, const void *data, size_t size)
|
||||
{
|
||||
if (size == 0)
|
||||
fatalx("zero size");
|
||||
|
||||
buffer_ensure(b, size);
|
||||
memcpy(BUFFER_IN(b), data, size);
|
||||
buffer_add(b, size);
|
||||
@ -127,7 +124,7 @@ buffer_write8(struct buffer *b, uint8_t n)
|
||||
{
|
||||
buffer_ensure(b, 1);
|
||||
BUFFER_IN(b)[0] = n;
|
||||
buffer_add(b, 1);
|
||||
b->size++;
|
||||
}
|
||||
|
||||
/* Extract an 8-bit value. */
|
||||
|
Reference in New Issue
Block a user