diff --git a/config.def.h b/config.def.h index 0a878c0..0eb2264 100644 --- a/config.def.h +++ b/config.def.h @@ -4,9 +4,6 @@ /* buffer size for capturing output of the programs used for updating blocks */ #define CMDOUTLENGTH 50 -/* buffer size for status text */ -#define STATUSLENGTH 256 - /* DELIMITERENDCHAR must be less than 32. * At max, DELIMITERENDCHAR - 1 number of clickable blocks are allowed. * Raw characters larger than DELIMITERENDCHAR and smaller than ' ' in ASCII diff --git a/dwmblocks.c b/dwmblocks.c index eb16f62..a38cdf6 100644 --- a/dwmblocks.c +++ b/dwmblocks.c @@ -13,6 +13,7 @@ #define LOCKFILE "/tmp/dwmblocks.pid" #define DELIMITERLENGTH sizeof delimiter +#define STATUSLENGTH ((sizeof blocks / sizeof blocks[0]) * (CMDOUTLENGTH + DELIMITERLENGTH)) #include "config.h" @@ -239,7 +240,7 @@ updateblock(Block *block, int sigval) void updatestatus() { - static char statustext[STATUSLENGTH + DELIMITERLENGTH]; + static char statustext[STATUSLENGTH]; char *s = statustext; Block *block;