---
st.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff -r 8d36e2eeb58c -r fe7ba4f517e4 st.c
--- a/st.c Sun Sep 16 20:43:51 2012 +0200
+++ b/st.c Mon Sep 17 22:11:20 2012 +0200
_AT_@ -324,6 +324,7 @@
static void *xmalloc(size_t);
static void *xrealloc(void *, size_t);
+static void *xcalloc(size_t nmemb, size_t size);
static void (*handler[LASTEvent])(XEvent *) = {
[KeyPress] = kpress,
_AT_@ -373,6 +374,14 @@
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;
_AT_@ -1801,8 +1810,8 @@
/* allocate any new rows */
for(/* i == minrow */; i < row; i++) {
term.dirty[i] = 1;
- term.line[i] = calloc(col, sizeof(Glyph));
- term.alt [i] = calloc(col, sizeof(Glyph));
+ term.line[i] = xcalloc(col, sizeof(Glyph));
+ term.alt [i] = xcalloc(col, sizeof(Glyph));
}
if(col > term.col) {
bool *bp = term.tabs + term.col;
Received on Mon Sep 17 2012 - 22:46:40 CEST
This archive was generated by hypermail 2.3.0 : Mon Sep 17 2012 - 22:48:06 CEST