Ensure ‘new_mode’ is initialized; fixes compiler warning

wlopm.c: In function ‘sync_handle_done’:
wlr-output-power-management-unstable-v1.h:295:9: error: ‘new_mode’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  295 |         wl_proxy_marshal((struct wl_proxy *) zwlr_output_power_v1,
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  296 |                          ZWLR_OUTPUT_POWER_V1_SET_MODE, mode);
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
wlopm.c:178:40: note: ‘new_mode’ was declared here
  178 |         enum zwlr_output_power_v1_mode new_mode;
      |                                        ^~~~~~~~
This commit is contained in:
Daniel Eklöf 2021-08-06 23:01:16 +02:00 committed by Leon Henrik Plickat
parent a385b761bd
commit 4ffa09316d

View File

@ -175,7 +175,7 @@ static struct Output *output_from_name (const char *str)
static void output_set_power_mode (struct Output *output, enum Power_mode mode)
{
enum zwlr_output_power_v1_mode new_mode;
enum zwlr_output_power_v1_mode new_mode = ZWLR_OUTPUT_POWER_V1_MODE_ON;
switch (mode)
{
case ON: