summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLandry Breuil <landry@openbsd.org>2022-08-09 18:45:18 +0200
committerLandry Breuil <landry@openbsd.org>2022-08-25 11:43:05 +0000
commitcb4193ff9d2c421d5dc1bef054fb05521003f8d4 (patch)
tree2c653c87a8442a7ddf36a0c8b28a9f4c856e1e8a
parentb643f272a70edb5ee4107c861a77973efdc94213 (diff)
downloadupower-cb4193ff9d2c421d5dc1bef054fb05521003f8d4.tar.gz
openbsd: initialize new_state with a default value before using it
otherwise the native build on openbsd complains: ../src/openbsd/up-backend.c:278:23: warning: variable 'new_state' is uninitialized when used here [-Wuninitialized] new_time_to_empty = (new_state == UP_DEVICE_STATE_DISCHARGING && a.minutes_left > 0 ? a.minutes_left : 0); ^~~~~~~~~ regression from 8be73b98 ?
-rw-r--r--src/openbsd/up-backend.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/openbsd/up-backend.c b/src/openbsd/up-backend.c
index f648682..a4a607e 100644
--- a/src/openbsd/up-backend.c
+++ b/src/openbsd/up-backend.c
@@ -312,7 +312,7 @@ up_backend_update_battery_state(UpDevice* device)
gdouble percentage;
gboolean ret, is_present;
struct sensordev sdev;
- UpDeviceState cur_state, new_state;
+ UpDeviceState cur_state, new_state = UP_DEVICE_STATE_UNKNOWN;
gint64 cur_time_to_empty, new_time_to_empty;
struct apm_power_info a;