mirror of
https://github.com/xzeldon/htop.git
synced 2024-12-24 15:15:44 +00:00
Make scope of match macro symmetric
This commit is contained in:
parent
493217e814
commit
9a16b1079e
@ -232,9 +232,11 @@ static void Battery_getSysData(double* level, ACPresence* isOnAC) {
|
||||
bool now = false;
|
||||
int fullSize = 0;
|
||||
double capacityLevel = NAN;
|
||||
|
||||
#define match(str,prefix) \
|
||||
(String_startsWith(str,prefix) ? (str) + strlen(prefix) : NULL)
|
||||
|
||||
while ((line = strsep(&buf, "\n")) != NULL) {
|
||||
#define match(str,prefix) \
|
||||
(String_startsWith(str,prefix) ? (str) + strlen(prefix) : NULL)
|
||||
const char* ps = match(line, "POWER_SUPPLY_");
|
||||
if (!ps) {
|
||||
continue;
|
||||
@ -266,7 +268,9 @@ static void Battery_getSysData(double* level, ACPresence* isOnAC) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#undef match
|
||||
|
||||
#undef match
|
||||
|
||||
if (!now && full && !isnan(capacityLevel)) {
|
||||
totalRemain += (capacityLevel * fullSize);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user