X-Git-Url: https://jasonwoof.com/gitweb/?p=st.git;a=blobdiff_plain;f=st.c;h=0fa0c8668d724910d00f84ad9b69ed296ad23546;hp=c751aa178b3893104d20252c9a3bd677c2e1a4cd;hb=4245ba0d12a330b3e54c6498e88024d90956ae34;hpb=f3d438b1015a031bc543bb2d65c81cc2329787d4 diff --git a/st.c b/st.c index c751aa1..0fa0c86 100644 --- a/st.c +++ b/st.c @@ -420,7 +420,6 @@ static int isfullutf8(char *, int); static ssize_t xwrite(int, char *, size_t); static void *xmalloc(size_t); static void *xrealloc(void *, size_t); -static void *xcalloc(size_t, size_t); static void (*handler[LASTEvent])(XEvent *) = { [KeyPress] = kpress, @@ -509,16 +508,6 @@ xrealloc(void *p, size_t len) { return p; } -void * -xcalloc(size_t nmemb, size_t size) { - void *p = calloc(nmemb, size); - - if(!p) - die("Out of memory\n"); - - return p; -} - int utf8decode(char *s, long *u) { uchar c; @@ -1370,7 +1359,7 @@ treset(void) { void tnew(int col, int row) { - memset(&term, 0, sizeof(Term)); + term = (Term){ .c = { .attr = { .fg = defaultfg, .bg = defaultbg } } }; tresize(col, row); term.numlock = 1; @@ -2536,8 +2525,8 @@ tresize(int col, int row) { /* allocate any new rows */ for(/* i == minrow */; i < row; i++) { term.dirty[i] = 1; - term.line[i] = xcalloc(col, sizeof(Glyph)); - term.alt [i] = xcalloc(col, sizeof(Glyph)); + term.line[i] = xmalloc(col * sizeof(Glyph)); + term.alt[i] = xmalloc(col * sizeof(Glyph)); } if(col > term.col) { bp = term.tabs + term.col;