summaryrefslogtreecommitdiffstats
path: root/grid.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 /grid.c
parent234ad54b2c7b1b1b9a78d3ecc20d29c12dd2f107 (diff)
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 'grid.c')
-rw-r--r--grid.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/grid.c b/grid.c
index 50b3569a..31cc430b 100644
--- a/grid.c
+++ b/grid.c
@@ -198,6 +198,10 @@ grid_expand_line(struct grid *gd, u_int py, u_int sx)
if (sx <= gl->cellsize)
return;
+ if (gl->cellsize > gd->sx / 2)
+ sx = gd->sx;
+ else
+ sx = 1 + gl->cellsize * 2;
gl->celldata = xrealloc(gl->celldata, sx, sizeof *gl->celldata);
for (xx = gl->cellsize; xx < sx; xx++)
grid_put_cell(gd, xx, py, &grid_default_cell);