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

Commit

Permalink
Linting changes
Browse files Browse the repository at this point in the history
as reported by lgtm.com
  • Loading branch information
hishamhm committed Feb 10, 2019
1 parent 90518bf commit 402e46b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions linux/LinuxProcessList.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion scripts/MakeHeader.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
StringIO = io.StringIO

ANY=1
COPY=2
Expand Down

0 comments on commit 402e46b

Please sign in to comment.