X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=st.c;h=9371b628b4493684eef6c941f85ca135059a3d88;hb=d2ec39f0ef4b9d7f291aeba548a56144fce8a42f;hp=37bec706e27fdb2dc81c4061c1636888c53ccc2a;hpb=315b7ee9ce13603339104cab0402d7d6c10e92b8;p=st.git diff --git a/st.c b/st.c index 37bec70..9371b62 100644 --- a/st.c +++ b/st.c @@ -441,6 +441,7 @@ 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 char *xstrdup(char *s); static void (*handler[LASTEvent])(XEvent *) = { [KeyPress] = kpress, @@ -529,6 +530,16 @@ xrealloc(void *p, size_t len) { return p; } +char * +xstrdup(char *s) { + char *p = strdup(s); + + if (!p) + die("Out of memory\n"); + + return p; +} + int utf8decode(char *s, long *u) { uchar c; @@ -2790,7 +2801,8 @@ xhints(void) { sizeh->min_height = sizeh->max_height = xw.fh; } - XSetWMProperties(xw.dpy, xw.win, NULL, NULL, NULL, 0, sizeh, &wm, &class); + XSetWMProperties(xw.dpy, xw.win, NULL, NULL, NULL, 0, sizeh, &wm, + &class); XFree(sizeh); } @@ -3789,7 +3801,7 @@ main(int argc, char *argv[]) { if(argc > 1) { opt_cmd = &argv[1]; if(argv[1] != NULL && opt_title == NULL) { - titles = strdup(argv[1]); + titles = xstrdup(argv[1]); opt_title = basename(titles); } }