diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2019-02-10 12:32:47 +0100 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2019-02-10 14:16:46 +0100 |
commit | 402e46bb82964366746b86d77eb5afa69c279539 (patch) | |
tree | 84b70784cb415dfdf3fe891f6545b8994920781a /linux | |
parent | 90518bfc8415adccc7d89bc7b57723be7b5e488b (diff) |
Linting changes
as reported by lgtm.com
Diffstat (limited to 'linux')
-rw-r--r-- | linux/LinuxProcessList.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c index 62bc0967..5f38540c 100644 --- a/linux/LinuxProcessList.c +++ b/linux/LinuxProcessList.c @@ -927,30 +927,30 @@ static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) { char buffer[128]; while (fgets(buffer, 128, file)) { - #define tryRead(label, variable) (String_startsWith(buffer, label) && sscanf(buffer + strlen(label), " %32llu kB", variable)) + #define tryRead(label, variable) do { if (String_startsWith(buffer, label) && sscanf(buffer + strlen(label), " %32llu kB", variable)) { break; } } while(0) switch (buffer[0]) { case 'M': - if (tryRead("MemTotal:", &this->totalMem)) {} - else if (tryRead("MemFree:", &this->freeMem)) {} - else if (tryRead("MemShared:", &this->sharedMem)) {} + tryRead("MemTotal:", &this->totalMem); + tryRead("MemFree:", &this->freeMem); + tryRead("MemShared:", &this->sharedMem); break; case 'B': - if (tryRead("Buffers:", &this->buffersMem)) {} + tryRead("Buffers:", &this->buffersMem); break; case 'C': - if (tryRead("Cached:", &this->cachedMem)) {} + tryRead("Cached:", &this->cachedMem); break; case 'S': switch (buffer[1]) { case 'w': - if (tryRead("SwapTotal:", &this->totalSwap)) {} - else if (tryRead("SwapFree:", &swapFree)) {} + tryRead("SwapTotal:", &this->totalSwap); + tryRead("SwapFree:", &swapFree); break; case 'h': - if (tryRead("Shmem:", &shmem)) {} + tryRead("Shmem:", &shmem); break; case 'R': - if (tryRead("SReclaimable:", &sreclaimable)) {} + tryRead("SReclaimable:", &sreclaimable); break; } break; |