aboutsummaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-08-20 19:14:42 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-08-20 19:14:42 +0000
commit1501b3fbbdf405aae7dc996a60bd22a49c884110 (patch)
tree9031656cc31c7b68ef378ea28b923ceca4833f56 /buffer.c
parent234ad54b2c7b1b1b9a78d3ecc20d29c12dd2f107 (diff)
downloadrtmux-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.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/buffer.c b/buffer.c
index f52d6352..5505bf74 100644
--- a/buffer.c
+++ b/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. */