diff options
author | Alexander Sedov | 2013-04-15 00:12:10 +0400 |
---|---|---|
committer | Christoph Lohmann | 2013-04-18 06:39:43 +0200 |
commit | fed9968ba5d3c6874f73517b261968746d36801e (patch) | |
tree | 8a2b438f09837ef130b94812c9a7716d5ec5870e | |
parent | 0ca0dd8b11ec0febc547e485395b7c9ec01e2866 (diff) | |
download | st-fed9968ba5d3c6874f73517b261968746d36801e.tar.gz st-fed9968ba5d3c6874f73517b261968746d36801e.tar.xz st-fed9968ba5d3c6874f73517b261968746d36801e.zip |
Got rid of code duplication in tnew() and tresize().
Signed-off-by: Christoph Lohmann <20h@r-36.net>
-rw-r--r-- | st.c | 18 |
1 files changed, 3 insertions, 15 deletions
@@ -1195,22 +1195,10 @@ treset(void) { void tnew(int col, int row) { - /* set screen size */ - term.row = row; - term.col = col; - 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; - } - + /* setting "zero" terminal to resize it later */ + memset(&term, 0, sizeof(Term)); + tresize(col, row); term.numlock = 1; - memset(term.tabs, 0, term.col * sizeof(*term.tabs)); /* setup screen */ treset(); } |