- free(term.line);
-
- LIMIT(term.c.x, 0, col-1);
- LIMIT(term.c.y, 0, row-1);
- LIMIT(term.top, 0, row-1);
- LIMIT(term.bot, 0, row-1);
+ free(term.alt[i]);
+ }
+
+ /* resize to new height */
+ term.line = realloc(term.line, row * sizeof(Line));
+ term.line = realloc(term.alt, row * sizeof(Line));
+
+ /* resize each row to new width, zero-pad if needed */
+ for(i = 0; i < minrow; i++) {
+ term.line[i] = realloc(term.line[i], col * sizeof(Glyph));
+ term.alt[i] = realloc(term.alt[i], col * sizeof(Glyph));
+ memset(term.line[i] + mincol, 0, (col - mincol) * sizeof(Glyph));
+ memset(term.alt[i] + mincol, 0, (col - mincol) * sizeof(Glyph));
+ }
+
+ /* allocate any new rows */
+ for(/* i == minrow */; i < row; i++) {
+ term.line[i] = calloc(col, sizeof(Glyph));
+ term.alt [i] = calloc(col, sizeof(Glyph));
+ }