temp: Put sysctl into define to avoid line wraps
Long, wrapped, multi-line if statements suck to read. This fixes readability.
This commit is contained in:
parent
69b2487650
commit
21327e0373
@ -53,6 +53,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
|
|
||||||
|
#define ACPI_TEMP "hw.acpi.thermal.%s.temperature"
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
temp(const char *zone)
|
temp(const char *zone)
|
||||||
{
|
{
|
||||||
@ -61,8 +63,8 @@
|
|||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
len = sizeof(temp);
|
len = sizeof(temp);
|
||||||
snprintf(buf, sizeof(buf), "hw.acpi.thermal.%s.temperature", zone);
|
snprintf(buf, sizeof(buf), ACPI_TEMP, zone);
|
||||||
if (sysctlbyname(buf, &temp, &len, NULL, 0) == -1
|
if (sysctlbyname(buf, &temp, &len, NULL, 0) < 0
|
||||||
|| !len)
|
|| !len)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user