summaryrefslogtreecommitdiff
path: root/components/cpu.c
diff options
context:
space:
mode:
authordrkhsh <me@drkhsh.at>2022-10-27 23:44:52 +0200
committerdrkhsh <me@drkhsh.at>2022-10-28 01:01:10 +0200
commit69b2487650782f135db76078c4a7fb841cb936ac (patch)
treee236b6b8503587b9263f45e775204a64463c5ca3 /components/cpu.c
parentc46c1487a986496dd813ec52e17e5bf9ba10fd84 (diff)
downloadslstatus-69b2487650782f135db76078c4a7fb841cb936ac.tar.gz
various: Put paths into defines to avoid line wraps
Long, wrapped, multi-line if statements suck to read. This fixes readability in the worst places by packing format strings for paths into defines.
Diffstat (limited to 'components/cpu.c')
-rw-r--r--components/cpu.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/components/cpu.c b/components/cpu.c
index 254f047..28e9a45 100644
--- a/components/cpu.c
+++ b/components/cpu.c
@@ -7,16 +7,16 @@
#include "../slstatus.h"
#if defined(__linux__)
+ #define CPU_FREQ "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq"
+
const char *
cpu_freq(const char *unused)
{
uintmax_t freq;
/* in kHz */
- if (pscanf("/sys/devices/system/cpu/cpu0/cpufreq/"
- "scaling_cur_freq", "%ju", &freq) != 1) {
+ if (pscanf(CPU_FREQ, "%ju", &freq) != 1)
return NULL;
- }
return fmt_human(freq * 1000, 1000);
}