summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2017-02-03 20:53:03 +0000
committernicm <nicm@openbsd.org>2017-02-03 20:53:03 +0000
commitb68f401a47b5bee24b546126cfc3e18675ad29e6 (patch)
tree3b7d3e970e59829ea1bd4665daca09a124336614
parentMinor cleanup, no functional change: (diff)
downloadwireguard-openbsd-b68f401a47b5bee24b546126cfc3e18675ad29e6.tar.xz
wireguard-openbsd-b68f401a47b5bee24b546126cfc3e18675ad29e6.zip
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);