Expand lines more aggressively to reduce rate of allocations.

pull/757/head
nicm 2017-02-03 20:53:03 +00:00
parent 7d23d019c0
commit 75adf8368a
1 changed files with 6 additions and 0 deletions

6
grid.c
View File

@ -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);