From d7ecbd51cf297c265e9fcd1734fe6a46f8e4b3f4 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Thu, 24 Nov 2016 11:25:56 +0300 Subject: [PATCH] (radio_callback): cosmetics. * [MSG_HOTKEY]: remove extra block. * [MSG_KEY]: do not fall through. Signed-off-by: Andrew Borodin --- lib/widget/radio.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/widget/radio.c b/lib/widget/radio.c index 98bc42219..cf44ac5b5 100644 --- a/lib/widget/radio.c +++ b/lib/widget/radio.c @@ -60,21 +60,20 @@ radio_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d switch (msg) { case MSG_HOTKEY: + for (i = 0; i < r->count; i++) { - for (i = 0; i < r->count; i++) + if (r->texts[i].hotkey != NULL) { - if (r->texts[i].hotkey != NULL) - { - int c = g_ascii_tolower ((gchar) r->texts[i].hotkey[0]); - - if (c != parm) - continue; - r->pos = i; - - /* Take action */ - send_message (w, sender, MSG_KEY, ' ', data); - return MSG_HANDLED; - } + int c; + + c = g_ascii_tolower ((gchar) r->texts[i].hotkey[0]); + if (c != parm) + continue; + r->pos = i; + + /* Take action */ + send_message (w, sender, MSG_KEY, ' ', data); + return MSG_HANDLED; } } return MSG_NOT_HANDLED; @@ -106,6 +105,8 @@ radio_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d widget_redraw (w); return MSG_HANDLED; } + return MSG_NOT_HANDLED; + default: return MSG_NOT_HANDLED; } -- 2.11.4.GIT