Code

colors: return bool instead of int
[ncmpc.git] / src / progress_bar.c
index 601b7ba3fa55ee3650a56d3329b84a66d85641b4..9df7a510ebd305a842ec8d368efba8bfe32a1044 100644 (file)
@@ -1,5 +1,5 @@
 /* ncmpc (Ncurses MPD Client)
- * (c) 2004-2010 The Music Player Daemon Project
+ * (c) 2004-2017 The Music Player Daemon Project
  * Project homepage: http://musicpd.org
  *
  * This program is free software; you can redistribute it and/or modify
@@ -43,12 +43,10 @@ progress_bar_paint(const struct progress_bar *p)
 static bool
 progress_bar_calc(struct progress_bar *p)
 {
-       unsigned old_width;
-
        if (p->max == 0)
                return false;
 
-       old_width = p->width;
+       unsigned old_width = p->width;
        p->width = (p->window.cols * p->current) / (p->max + 1);
        assert(p->width < p->window.cols);
 
@@ -70,14 +68,12 @@ progress_bar_resize(struct progress_bar *p, unsigned width, int y, int x)
 bool
 progress_bar_set(struct progress_bar *p, unsigned current, unsigned max)
 {
-       bool modified;
-
        assert(p != NULL);
 
        if (current > max)
                current = max;
 
-       modified = (max == 0) != (p->max == 0);
+       bool modified = (max == 0) != (p->max == 0);
 
        p->max = max;
        p->current = current;