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.
This commit is contained in:
drkhsh
2022-10-27 23:44:52 +02:00
parent c46c1487a9
commit 69b2487650
5 changed files with 36 additions and 41 deletions

View File

@ -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);
}