button: Fix a set-but-unused variable without HAVE_SW_POWEROFF

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]> Thu, 28 May 2026 22:36:51 -0400
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit d1f1d1da5ea1006db1c553e0e247167343013307
Author: Solomon Peachy <[email protected]>
Date:   Thu May 28 22:34:23 2026 -0400

    button:  Fix a set-but-unused variable without HAVE_SW_POWEROFF
    
    So wrap the definition and setting of repeat_count with the
    same #ifdef
    
    Change-Id: I8c06ea68eca7e5db960e4fa08a866761e856293e

diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index a68b343629..b6cc0f4f33 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -201,7 +201,9 @@ static void button_tick(void)
 {
     static int count = 0;
     static int repeat_speed = REPEAT_INTERVAL_START;
+#ifdef HAVE_SW_POWEROFF
     static int repeat_count = 0;
+#endif
     static bool repeat = false;
     static bool post = false;
 #ifdef HAVE_BACKLIGHT
@@ -291,12 +293,12 @@ static void button_tick(void)
 
                         count = repeat_speed;
 
+#ifdef HAVE_SW_POWEROFF
                         repeat_count++;
-
                         /* Send a SYS_POWEROFF event if we have a device
                            which doesn't shut down easily with the OFF
                            key */
-#ifdef HAVE_SW_POWEROFF
+
                         if (enable_sw_poweroff &&
                             (btn & POWEROFF_BUTTON
 #ifdef RC_POWEROFF_BUTTON
@@ -336,7 +338,9 @@ static void button_tick(void)
                     {
                         post = true;
                         repeat = true;
+#ifdef HAVE_SW_POWEROFF
                         repeat_count = 0;
+#endif
                         /* initial repeat */
 #ifdef HAVE_TOUCHSCREEN
                         if (btn & BUTTON_TOUCHSCREEN)
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs