aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authorAlexander Sedov <alex0player@gmail.com>2013-04-15 00:12:10 +0400
committerChristoph Lohmann <20h@r-36.net>2013-04-18 06:39:43 +0200
commitfed9968ba5d3c6874f73517b261968746d36801e (patch)
tree8a2b438f09837ef130b94812c9a7716d5ec5870e /st.c
parent0ca0dd8b11ec0febc547e485395b7c9ec01e2866 (diff)
downloadst-fed9968ba5d3c6874f73517b261968746d36801e.tar.gz
st-fed9968ba5d3c6874f73517b261968746d36801e.zip
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 56dc94c..fc07a46 100644
--- a/st.c
+++ b/st.c
@@ -1195,22 +1195,10 @@ treset(void) {
1195 1195
1196void 1196void
1197tnew(int col, int row) { 1197tnew(int col, int row) {
1198 /* set screen size */ 1198 /* setting "zero" terminal to resize it later */
1199 term.row = row; 1199 memset(&term, 0, sizeof(Term));
1200 term.col = col; 1200 tresize(col, row);
1201 term.line = xmalloc(term.row * sizeof(Line));
1202 term.alt = xmalloc(term.row * sizeof(Line));
1203 term.dirty = xmalloc(term.row * sizeof(*term.dirty));
1204 term.tabs = xmalloc(term.col * sizeof(*term.tabs));
1205
1206 for(row = 0; row < term.row; row++) {
1207 term.line[row] = xmalloc(term.col * sizeof(Glyph));
1208 term.alt [row] = xmalloc(term.col * sizeof(Glyph));
1209 term.dirty[row] = 0;
1210 }
1211
1212 term.numlock = 1; 1201 term.numlock = 1;
1213 memset(term.tabs, 0, term.col * sizeof(*term.tabs));
1214 /* setup screen */ 1202 /* setup screen */
1215 treset(); 1203 treset();
1216} 1204}