aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--st.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/st.c b/st.c
index d5ecf61..df7f8d8 100644
--- a/st.c
+++ b/st.c
@@ -324,6 +324,7 @@ static int isfullutf8(char *, int);
324 324
325static void *xmalloc(size_t); 325static void *xmalloc(size_t);
326static void *xrealloc(void *, size_t); 326static void *xrealloc(void *, size_t);
327static void *xcalloc(size_t nmemb, size_t size);
327 328
328static void (*handler[LASTEvent])(XEvent *) = { 329static void (*handler[LASTEvent])(XEvent *) = {
329 [KeyPress] = kpress, 330 [KeyPress] = kpress,
@@ -373,6 +374,14 @@ xrealloc(void *p, size_t len) {
373 return p; 374 return p;
374} 375}
375 376
377void *
378xcalloc(size_t nmemb, size_t size) {
379 void *p = calloc(nmemb, size);
380 if(!p)
381 die("Out of memory\n");
382 return p;
383}
384
376int 385int
377utf8decode(char *s, long *u) { 386utf8decode(char *s, long *u) {
378 uchar c; 387 uchar c;
@@ -1801,8 +1810,8 @@ tresize(int col, int row) {
1801 /* allocate any new rows */ 1810 /* allocate any new rows */
1802 for(/* i == minrow */; i < row; i++) { 1811 for(/* i == minrow */; i < row; i++) {
1803 term.dirty[i] = 1; 1812 term.dirty[i] = 1;
1804 term.line[i] = calloc(col, sizeof(Glyph)); 1813 term.line[i] = xcalloc(col, sizeof(Glyph));
1805 term.alt [i] = calloc(col, sizeof(Glyph)); 1814 term.alt [i] = xcalloc(col, sizeof(Glyph));
1806 } 1815 }
1807 if(col > term.col) { 1816 if(col > term.col) {
1808 bool *bp = term.tabs + term.col; 1817 bool *bp = term.tabs + term.col;