Removed #define for update interval
authorAaron Marcher <me@drkhsh.at>
Sat, 12 Aug 2017 11:06:24 +0000 (13:06 +0200)
committerAaron Marcher <me@drkhsh.at>
Sat, 12 Aug 2017 11:16:12 +0000 (13:16 +0200)
Debugging #define, especially in mathematical constructs is very
difficult. The performance overhead of static const int is negligible.

config.def.h
slstatus.c

index ed339edbfdba9c163e5c9e1a2827cdbf900ecbf2..2b06f347051e4aa3a0392ea90347d85a59e4d442 100644 (file)
@@ -1,7 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 
 /* how often to update the statusbar (min value == 1) */
-#define UPDATE_INTERVAL 1
+static const int update_interval = 1;
 
 /* text to show if no value can be retrieved */
 #define UNKNOWN_STR "n/a"
index aa05cd1e59089a369235eb6601bc4361198607bc..228c19b311b30bf0f3c21b52f8133f3ddf619c3b 100644 (file)
@@ -914,11 +914,11 @@ main(int argc, char *argv[])
                        XSync(dpy, False);
                }
 
-               if ((UPDATE_INTERVAL - delay) <= 0) {
+               if ((update_interval - delay) <= 0) {
                        delay = 0;
                        continue;
                } else {
-                       sleep(UPDATE_INTERVAL - delay);
+                       sleep(update_interval - delay);
                        delay = 0;
                }
        }