Merge pull request #15 from tomboehmer/issue9

Fixes #9 - determine the size of the status buffer based on the number of blocks
This commit is contained in:
torrinfail 2020-08-11 20:04:51 -07:00 committed by GitHub
commit d2e6d20ebf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,7 @@
#include<X11/Xlib.h> #include<X11/Xlib.h>
#define LENGTH(X) (sizeof(X) / sizeof (X[0])) #define LENGTH(X) (sizeof(X) / sizeof (X[0]))
#define CMDLENGTH 50 #define CMDLENGTH 50
#define STATUSLENGTH (LENGTH(blocks) * CMDLENGTH + 1)
typedef struct { typedef struct {
char* icon; char* icon;
@ -33,7 +34,7 @@ static Display *dpy;
static int screen; static int screen;
static Window root; static Window root;
static char statusbar[LENGTH(blocks)][CMDLENGTH] = {0}; static char statusbar[LENGTH(blocks)][CMDLENGTH] = {0};
static char statusstr[2][256]; static char statusstr[2][STATUSLENGTH];
static int statusContinue = 1; static int statusContinue = 1;
static void (*writestatus) () = setroot; static void (*writestatus) () = setroot;