aboutsummarylogtreecommitdiffstats
path: root/st.c
diff options
context:
space:
mode:
authorAlexander Sedov2013-04-15 00:12:10 +0400
committerChristoph Lohmann2013-04-18 06:39:43 +0200
commit12bda6f5ee6a0810badb3b58d92e889376978c7c (patch)
tree715e295c9816a645a6352a205102a713a148d6be /st.c
parent11ee20422fd4a5fb3854a01752428c8440f4672c (diff)
downloadaur-12bda6f5ee6a0810badb3b58d92e889376978c7c.tar.gz
Got rid of code duplication in tnew() and tresize().
Signed-off-by: Christoph Lohmann <20h@r-36.net>
Diffstat (limited to 'st.c')
-rw-r--r--st.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/st.c b/st.c
index 56dc94c611b9..fc07a4694308 100644
--- a/st.c
+++ b/st.c
@@ -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();
}