diff options
author | Tiago Cunha <tcunha@gmx.com> | 2009-08-21 21:09:13 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2009-08-21 21:09:13 +0000 |
commit | 4b883524d8da98b2f00e83437cc06bd65228fc5b (patch) | |
tree | 3ef96ab68b0aeae68b7cc7ad0a3d0d178ff6758f /buffer.c | |
parent | 15556ad0d67f3c1345fc4d462ab2949816ca7849 (diff) |
Sync OpenBSD patchset 282:
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 | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -1,4 +1,4 @@ -/* $Id: buffer.c,v 1.7 2009-06-25 16:21:32 nicm Exp $ */ +/* $Id: buffer.c,v 1.8 2009-08-21 21:09:13 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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. */ |