Got rid of code duplication in tnew() and tresize().

Signed-off-by: Christoph Lohmann <20h@r-36.net>
dev
Alexander Sedov 2013-04-15 00:12:10 +04:00 committed by Christoph Lohmann
parent 0ca0dd8b11
commit fed9968ba5
1 changed files with 3 additions and 15 deletions

18
st.c
View File

@ -1195,22 +1195,10 @@ treset(void) {
void void
tnew(int col, int row) { tnew(int col, int row) {
/* set screen size */ /* setting "zero" terminal to resize it later */
term.row = row; memset(&term, 0, sizeof(Term));
term.col = col; tresize(col, row);
term.line = xmalloc(term.row * sizeof(Line));
term.alt = xmalloc(term.row * sizeof(Line));
term.dirty = xmalloc(term.row * sizeof(*term.dirty));
term.tabs = xmalloc(term.col * sizeof(*term.tabs));
for(row = 0; row < term.row; row++) {
term.line[row] = xmalloc(term.col * sizeof(Glyph));
term.alt [row] = xmalloc(term.col * sizeof(Glyph));
term.dirty[row] = 0;
}
term.numlock = 1; term.numlock = 1;
memset(term.tabs, 0, term.col * sizeof(*term.tabs));
/* setup screen */ /* setup screen */
treset(); treset();
} }