From 5b50ae3aa3a418f3f84ff2fdb172ab447753814f Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Tue, 2 Mar 2021 15:58:11 +1100 Subject: Separate display from sampling in SysArch and Hostname Meters Several of our newer meters have merged coding concerns in terms of extracting values and displaying those values. This commit rectifies that for the SysArch and Hostname meters, allowing use of this code with alternative front/back ends. The SysArch code is also refined to detect whether the platform has an os-release file at all and/or the sys/utsname.h header via configure.ac. --- HostnameMeter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'HostnameMeter.c') diff --git a/HostnameMeter.c b/HostnameMeter.c index af8e3493..924def11 100644 --- a/HostnameMeter.c +++ b/HostnameMeter.c @@ -8,6 +8,7 @@ in the source distribution for its full text. #include "config.h" // IWYU pragma: keep #include "HostnameMeter.h" +#include "Platform.h" #include @@ -19,9 +20,8 @@ static const int HostnameMeter_attributes[] = { HOSTNAME }; -static void HostnameMeter_updateValues(Meter* this, char* buffer, size_t size) { - (void) this; - gethostname(buffer, size - 1); +static void HostnameMeter_updateValues(ATTR_UNUSED Meter* this, char* buffer, size_t size) { + Platform_getHostname(buffer, size); } const MeterClass HostnameMeter_class = { -- cgit v1.2.3