Skip to content

Commit

Permalink
SysArchMeter: avoid static variable
Browse files Browse the repository at this point in the history
  • Loading branch information
cgzones committed Mar 2, 2021
1 parent dc8124e commit a40347e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions SysArchMeter.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,17 @@ static void parseOSRelease(char* buffer, size_t bufferLen) {
}

static void SysArchMeter_updateValues(ATTR_UNUSED Meter* this, char* buffer, size_t size) {
static struct utsname uname_info;

static char savedString[
/* uname structure fields - manpages recommend sizeof */
sizeof(uname_info.sysname) +
sizeof(uname_info.release) +
sizeof(uname_info.machine) +
sizeof(((struct utsname*)0)->sysname) +
sizeof(((struct utsname*)0)->release) +
sizeof(((struct utsname*)0)->machine) +
16/*markup*/ +
128/*distro*/] = {'\0'};
static bool loaded_data = false;

if (!loaded_data) {
struct utsname uname_info;
int uname_result = uname(&uname_info);

char distro[128];
Expand Down

0 comments on commit a40347e

Please sign in to comment.