Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
htop
Commits
402e46bb
Commit
402e46bb
authored
Feb 10, 2019
by
Hisham Muhammad
Browse files
Linting changes
as reported by lgtm.com
parent
90518bfc
Changes
2
Hide whitespace changes
Inline
Side-by-side
linux/LinuxProcessList.c
View file @
402e46bb
...
@@ -927,30 +927,30 @@ static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) {
...
@@ -927,30 +927,30 @@ static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) {
char
buffer
[
128
];
char
buffer
[
128
];
while
(
fgets
(
buffer
,
128
,
file
))
{
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
])
{
switch
(
buffer
[
0
])
{
case
'M'
:
case
'M'
:
if
(
tryRead
(
"MemTotal:"
,
&
this
->
totalMem
)
)
{}
tryRead
(
"MemTotal:"
,
&
this
->
totalMem
)
;
else
if
(
tryRead
(
"MemFree:"
,
&
this
->
freeMem
)
)
{}
tryRead
(
"MemFree:"
,
&
this
->
freeMem
)
;
else
if
(
tryRead
(
"MemShared:"
,
&
this
->
sharedMem
)
)
{}
tryRead
(
"MemShared:"
,
&
this
->
sharedMem
)
;
break
;
break
;
case
'B'
:
case
'B'
:
if
(
tryRead
(
"Buffers:"
,
&
this
->
buffersMem
)
)
{}
tryRead
(
"Buffers:"
,
&
this
->
buffersMem
)
;
break
;
break
;
case
'C'
:
case
'C'
:
if
(
tryRead
(
"Cached:"
,
&
this
->
cachedMem
)
)
{}
tryRead
(
"Cached:"
,
&
this
->
cachedMem
)
;
break
;
break
;
case
'S'
:
case
'S'
:
switch
(
buffer
[
1
])
{
switch
(
buffer
[
1
])
{
case
'w'
:
case
'w'
:
if
(
tryRead
(
"SwapTotal:"
,
&
this
->
totalSwap
)
)
{}
tryRead
(
"SwapTotal:"
,
&
this
->
totalSwap
)
;
else
if
(
tryRead
(
"SwapFree:"
,
&
swapFree
)
)
{}
tryRead
(
"SwapFree:"
,
&
swapFree
)
;
break
;
break
;
case
'h'
:
case
'h'
:
if
(
tryRead
(
"Shmem:"
,
&
shmem
)
)
{}
tryRead
(
"Shmem:"
,
&
shmem
)
;
break
;
break
;
case
'R'
:
case
'R'
:
if
(
tryRead
(
"SReclaimable:"
,
&
sreclaimable
)
)
{}
tryRead
(
"SReclaimable:"
,
&
sreclaimable
)
;
break
;
break
;
}
}
break
;
break
;
...
...
scripts/MakeHeader.py
View file @
402e46bb
...
@@ -3,7 +3,7 @@ import os, sys, string, io
...
@@ -3,7 +3,7 @@ import os, sys, string, io
try
:
try
:
from
StringIO
import
StringIO
from
StringIO
import
StringIO
except
ImportError
:
except
ImportError
:
from
io
import
StringIO
StringIO
=
io
.
StringIO
ANY
=
1
ANY
=
1
COPY
=
2
COPY
=
2
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment