mirror of https://github.com/xzeldon/htop.git
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;
|
bool now = false;
|
||||||
int fullSize = 0;
|
int fullSize = 0;
|
||||||
double capacityLevel = NAN;
|
double capacityLevel = NAN;
|
||||||
while ((line = strsep(&buf, "\n")) != NULL) {
|
|
||||||
#define match(str,prefix) \
|
#define match(str,prefix) \
|
||||||
(String_startsWith(str,prefix) ? (str) + strlen(prefix) : NULL)
|
(String_startsWith(str,prefix) ? (str) + strlen(prefix) : NULL)
|
||||||
|
|
||||||
|
while ((line = strsep(&buf, "\n")) != NULL) {
|
||||||
const char* ps = match(line, "POWER_SUPPLY_");
|
const char* ps = match(line, "POWER_SUPPLY_");
|
||||||
if (!ps) {
|
if (!ps) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -266,7 +268,9 @@ static void Battery_getSysData(double* level, ACPresence* isOnAC) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef match
|
#undef match
|
||||||
|
|
||||||
if (!now && full && !isnan(capacityLevel)) {
|
if (!now && full && !isnan(capacityLevel)) {
|
||||||
totalRemain += (capacityLevel * fullSize);
|
totalRemain += (capacityLevel * fullSize);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue