Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit 402e46b

Browse files
committed
Linting changes
as reported by lgtm.com
1 parent 90518bf commit 402e46b

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

linux/LinuxProcessList.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -927,30 +927,30 @@ static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) {
927927
char buffer[128];
928928
while (fgets(buffer, 128, file)) {
929929

930-
#define tryRead(label, variable) (String_startsWith(buffer, label) && sscanf(buffer + strlen(label), " %32llu kB", variable))
930+
#define tryRead(label, variable) do { if (String_startsWith(buffer, label) && sscanf(buffer + strlen(label), " %32llu kB", variable)) { break; } } while(0)
931931
switch (buffer[0]) {
932932
case 'M':
933-
if (tryRead("MemTotal:", &this->totalMem)) {}
934-
else if (tryRead("MemFree:", &this->freeMem)) {}
935-
else if (tryRead("MemShared:", &this->sharedMem)) {}
933+
tryRead("MemTotal:", &this->totalMem);
934+
tryRead("MemFree:", &this->freeMem);
935+
tryRead("MemShared:", &this->sharedMem);
936936
break;
937937
case 'B':
938-
if (tryRead("Buffers:", &this->buffersMem)) {}
938+
tryRead("Buffers:", &this->buffersMem);
939939
break;
940940
case 'C':
941-
if (tryRead("Cached:", &this->cachedMem)) {}
941+
tryRead("Cached:", &this->cachedMem);
942942
break;
943943
case 'S':
944944
switch (buffer[1]) {
945945
case 'w':
946-
if (tryRead("SwapTotal:", &this->totalSwap)) {}
947-
else if (tryRead("SwapFree:", &swapFree)) {}
946+
tryRead("SwapTotal:", &this->totalSwap);
947+
tryRead("SwapFree:", &swapFree);
948948
break;
949949
case 'h':
950-
if (tryRead("Shmem:", &shmem)) {}
950+
tryRead("Shmem:", &shmem);
951951
break;
952952
case 'R':
953-
if (tryRead("SReclaimable:", &sreclaimable)) {}
953+
tryRead("SReclaimable:", &sreclaimable);
954954
break;
955955
}
956956
break;

scripts/MakeHeader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
try:
44
from StringIO import StringIO
55
except ImportError:
6-
from io import StringIO
6+
StringIO = io.StringIO
77

88
ANY=1
99
COPY=2

0 commit comments

Comments
 (0)