domsson / succade

Run, feed and style your Lemonbar with ease
Creative Commons Zero v1.0 Universal
55 stars 3 forks source link

Compile warnings #36

Closed domsson closed 3 years ago

domsson commented 4 years ago

Compile warnings from another user read as follows:

src/succade.c: In function ‘main’:
src/succade.c:1295:9: warning: variable ‘delta’ set but not used [-Wunused-but-set-variable]
 1295 |  double delta;
      |         ^~~~~
In function ‘barstr’,
    inlined from ‘feed_lemon’ at src/succade.c:877:16,
    inlined from ‘main’ at src/succade.c:1313:3:
src/succade.c:471:13: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  471 |  bar_str[0] = '\0';
      |  ~~~~~~~~~~~^~~~~~
src/succade.c: In function ‘main’:
src/succade.c:470:18: note: at offset 0 to an object with size 0 allocated by ‘malloc’ here
  470 |  char *bar_str = malloc(bar_str_len);

I know about the unused delta, that's expected and okay for now, but the other two should be investigated and fixed sooner than later.

domsson commented 4 years ago

I think this happens when we call barstr() while state->num_blocks is 0. Which indicates that there is some logic missing somewhere, as succade should abort if no blocks are loaded (unless the empty option, -e, is given).