diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-08-20 19:14:42 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-08-20 19:14:42 +0000 |
commit | 1501b3fbbdf405aae7dc996a60bd22a49c884110 (patch) | |
tree | 9031656cc31c7b68ef378ea28b923ceca4833f56 /buffer.c | |
parent | 234ad54b2c7b1b1b9a78d3ecc20d29c12dd2f107 (diff) | |
download | rtmux-1501b3fbbdf405aae7dc996a60bd22a49c884110.tar.gz rtmux-1501b3fbbdf405aae7dc996a60bd22a49c884110.tar.bz2 rtmux-1501b3fbbdf405aae7dc996a60bd22a49c884110.zip |
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.
Diffstat (limited to 'buffer.c')
-rw-r--r-- | buffer.c | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -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. */ |