diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2020-11-25 12:46:00 +0100 |
---|---|---|
committer | Christian Göttsche <cgzones@googlemail.com> | 2020-11-25 12:47:07 +0100 |
commit | 601ad61e7ddd5a79a0c650ff617b617470fafe07 (patch) | |
tree | 03734ee31c6dac9009cefe3286beaebbab43f7b6 /openbsd | |
parent | a3221f367779288090715f4098d9a874cd113ad3 (diff) |
Unify naming of first argument of Platform_getBattery
Use percent throughout
Diffstat (limited to 'openbsd')
-rw-r--r-- | openbsd/Platform.c | 8 | ||||
-rw-r--r-- | openbsd/Platform.h | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/openbsd/Platform.c b/openbsd/Platform.c index 550e2584..38fbab67 100644 --- a/openbsd/Platform.c +++ b/openbsd/Platform.c @@ -349,7 +349,7 @@ static bool findDevice(const char* name, int* mib, struct sensordev* snsrdev, si } } -void Platform_getBattery(double* level, ACPresence* isOnAC) { +void Platform_getBattery(double* percent, ACPresence* isOnAC) { static int mib[] = {CTL_HW, HW_SENSORS, 0, 0, 0}; struct sensor s; size_t slen = sizeof(struct sensor); @@ -358,7 +358,7 @@ void Platform_getBattery(double* level, ACPresence* isOnAC) { bool found = findDevice("acpibat0", mib, &snsrdev, &sdlen); - *level = NAN; + *percent = NAN; if (found) { /* last full capacity */ mib[3] = 7; @@ -372,9 +372,9 @@ void Platform_getBattery(double* level, ACPresence* isOnAC) { mib[4] = 3; if (sysctl(mib, 5, &s, &slen, NULL, 0) != -1) { double charge = s.value; - *level = 100 * (charge / last_full_capacity); + *percent = 100 * (charge / last_full_capacity); if (charge >= last_full_capacity) { - *level = 100; + *percent = 100; } } } diff --git a/openbsd/Platform.h b/openbsd/Platform.h index dd5c6529..07cde2f8 100644 --- a/openbsd/Platform.h +++ b/openbsd/Platform.h @@ -61,6 +61,6 @@ bool Platform_getNetworkIO(unsigned long int* bytesReceived, unsigned long int* bytesTransmitted, unsigned long int* packetsTransmitted); -void Platform_getBattery(double* level, ACPresence* isOnAC); +void Platform_getBattery(double* percent, ACPresence* isOnAC); #endif |