Skip to content

Commit

Permalink
Introduce sstrlen macro which calculates the length of a string literal.
Browse files Browse the repository at this point in the history
  • Loading branch information
martanne committed Feb 2, 2008
1 parent 46600bb commit 5bbbe32
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dvtm.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ enum { BarTop, BarBot, BarOff };

#define COLOR(fg, bg) madtty_color_pair(fg, bg)
#define countof(arr) (sizeof (arr) / sizeof((arr)[0]))
#define sstrlen(str) (sizeof (str) - 1)
#define max(x, y) ((x) > (y) ? (x) : (y))

#ifdef NDEBUG
Expand Down Expand Up @@ -433,7 +434,7 @@ draw_border(Client *c){
getyx(c->window, y, x);
curs_set(0);
mvwhline(c->window, 0, 0, ACS_HLINE, c->w);
o = c->w - (4 + strlen(TITLE) - 5 + strlen(SEPARATOR));
o = c->w - (4 + sstrlen(TITLE) - 5 + sstrlen(SEPARATOR));
if(o < 0)
o = 0;
if(o < sizeof(c->title)){
Expand Down

0 comments on commit 5bbbe32

Please sign in to comment.