summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2017-02-03 20:53:04 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2017-02-03 20:53:04 +0000
commitbbc1997b690563ba165f73867d58eb7afb273398 (patch)
treec9f9d9fadf01d9e10782ad312a204aceb2bfaef8
parentf257a9bc1e63f3751fe0457d3d0c35649868f3da (diff)
Expand lines more aggressively to reduce rate of allocations.
-rw-r--r--usr.bin/tmux/grid.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.bin/tmux/grid.c b/usr.bin/tmux/grid.c
index 9d4e636f07d..3580a415383 100644
--- a/usr.bin/tmux/grid.c
+++ b/usr.bin/tmux/grid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grid.c,v 1.60 2016/10/18 19:52:49 nicm Exp $ */
+/* $OpenBSD: grid.c,v 1.61 2017/02/03 20:53:03 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -292,6 +292,12 @@ grid_expand_line(struct grid *gd, u_int py, u_int sx, u_int bg)
if (sx <= gl->cellsize)
return;
+ if (sx < gd->sx) {
+ sx *= 2;
+ if (sx > gd->sx)
+ sx = gd->sx;
+ }
+
gl->celldata = xreallocarray(gl->celldata, sx, sizeof *gl->celldata);
for (xx = gl->cellsize; xx < sx; xx++)
grid_clear_cell(gd, xx, py, bg);