commit e9a9be8ec677b48739ed5f0a99cba29531ec11e6
parent 04bb8ac6664a53c5ac4fe0c9d1f2273e02905c8e
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 9 Dec 2017 14:22:20 +0100
use static buffer for break message, make buffer smaller
Diffstat:
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/pomodoro.c b/pomodoro.c
@@ -134,8 +134,8 @@ take_break(unsigned int bp)
return;
}
const char *n = "pomodoro";
- char *m = malloc(1024);
- snprintf(m, 1024, "Take a %d min break!", bp);
+ char m[64];
+ snprintf(m, sizeof(m), "Take a %d min break!", bp);
int s = DefaultScreen(d), ww = 128, wh = 64;
Window w = XCreateSimpleWindow(d, RootWindow(d, s),
DisplayWidth(d, s) / 2,
@@ -175,7 +175,6 @@ take_break(unsigned int bp)
default:
curtime = time(NULL);
if (difftime(curtime,prevtime) >= bp * 60) {
- free(m);
XFreeGC(d, gc);
XDestroyWindow(d, w);
XCloseDisplay(d);
@@ -191,7 +190,6 @@ take_break(unsigned int bp)
f->descent) / 2, m, strlen(m));
break;
case ClientMessage:
- free(m);
XFreeGC(d, gc);
XDestroyWindow(d, w);
XCloseDisplay(d);