diff options
Diffstat (limited to 'st.c')
-rw-r--r-- | st.c | 17 |
1 files changed, 3 insertions, 14 deletions
@@ -420,7 +420,6 @@ static int isfullutf8(char *, int); | |||
420 | static ssize_t xwrite(int, char *, size_t); | 420 | static ssize_t xwrite(int, char *, size_t); |
421 | static void *xmalloc(size_t); | 421 | static void *xmalloc(size_t); |
422 | static void *xrealloc(void *, size_t); | 422 | static void *xrealloc(void *, size_t); |
423 | static void *xcalloc(size_t, size_t); | ||
424 | 423 | ||
425 | static void (*handler[LASTEvent])(XEvent *) = { | 424 | static void (*handler[LASTEvent])(XEvent *) = { |
426 | [KeyPress] = kpress, | 425 | [KeyPress] = kpress, |
@@ -509,16 +508,6 @@ xrealloc(void *p, size_t len) { | |||
509 | return p; | 508 | return p; |
510 | } | 509 | } |
511 | 510 | ||
512 | void * | ||
513 | xcalloc(size_t nmemb, size_t size) { | ||
514 | void *p = calloc(nmemb, size); | ||
515 | |||
516 | if(!p) | ||
517 | die("Out of memory\n"); | ||
518 | |||
519 | return p; | ||
520 | } | ||
521 | |||
522 | int | 511 | int |
523 | utf8decode(char *s, long *u) { | 512 | utf8decode(char *s, long *u) { |
524 | uchar c; | 513 | uchar c; |
@@ -1370,7 +1359,7 @@ treset(void) { | |||
1370 | 1359 | ||
1371 | void | 1360 | void |
1372 | tnew(int col, int row) { | 1361 | tnew(int col, int row) { |
1373 | memset(&term, 0, sizeof(Term)); | 1362 | term = (Term){ .c = { .attr = { .fg = defaultfg, .bg = defaultbg } } }; |
1374 | tresize(col, row); | 1363 | tresize(col, row); |
1375 | term.numlock = 1; | 1364 | term.numlock = 1; |
1376 | 1365 | ||
@@ -2536,8 +2525,8 @@ tresize(int col, int row) { | |||
2536 | /* allocate any new rows */ | 2525 | /* allocate any new rows */ |
2537 | for(/* i == minrow */; i < row; i++) { | 2526 | for(/* i == minrow */; i < row; i++) { |
2538 | term.dirty[i] = 1; | 2527 | term.dirty[i] = 1; |
2539 | term.line[i] = xcalloc(col, sizeof(Glyph)); | 2528 | term.line[i] = xmalloc(col * sizeof(Glyph)); |
2540 | term.alt [i] = xcalloc(col, sizeof(Glyph)); | 2529 | term.alt[i] = xmalloc(col * sizeof(Glyph)); |
2541 | } | 2530 | } |
2542 | if(col > term.col) { | 2531 | if(col > term.col) { |
2543 | bp = term.tabs + term.col; | 2532 | bp = term.tabs + term.col; |