aboutsummaryrefslogtreecommitdiffstats
path: root/src/screen_help.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-17 12:25:41 +0200
committerMax Kellermann <max@duempel.org>2008-09-17 12:25:41 +0200
commit6321db0068e012ec29372fbc058203e6d2855bee (patch)
tree43e719c131d3961a772b3bbb1614c9934099171e /src/screen_help.c
parent93414ec4a69b58269715ceec18531e3177d66f5f (diff)
downloadmpd-6321db0068e012ec29372fbc058203e6d2855bee.tar.gz
mpd-6321db0068e012ec29372fbc058203e6d2855bee.tar.xz
mpd-6321db0068e012ec29372fbc058203e6d2855bee.zip
help: return early from list_callback()
Diffstat (limited to '')
-rw-r--r--src/screen_help.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/screen_help.c b/src/screen_help.c
index 05b735ecc..58ca6e13d 100644
--- a/src/screen_help.c
+++ b/src/screen_help.c
@@ -151,37 +151,37 @@ list_callback(unsigned idx, int *highlight, mpd_unused void *data)
{
static char buf[512];
- *highlight = 0;
- if (idx < help_text_rows) {
- *highlight = help_text[idx].highlight > 0;
- if (help_text[idx].command == CMD_NONE) {
- if (help_text[idx].text)
- g_snprintf(buf, sizeof(buf), " %s", _(help_text[idx].text));
- else if (help_text[idx].highlight == 2) {
- int i;
+ if (idx >= help_text_rows)
+ return NULL;
- for (i = 3; i < COLS - 3 && i < (int)sizeof(buf); i++)
- buf[i] = '-';
- buf[i] = '\0';
- } else
- g_strlcpy(buf, " ", sizeof(buf));
- return buf;
- }
+ if (help_text[idx].highlight)
+ *highlight = 1;
+ if (help_text[idx].command == CMD_NONE) {
if (help_text[idx].text)
- g_snprintf(buf, sizeof(buf),
- "%20s : %s ",
- get_key_names(help_text[idx].command, TRUE),
- _(help_text[idx].text));
- else
- g_snprintf(buf, sizeof(buf),
- "%20s : %s ",
- get_key_names(help_text[idx].command, TRUE),
- get_key_description(help_text[idx].command));
+ g_snprintf(buf, sizeof(buf), " %s", _(help_text[idx].text));
+ else if (help_text[idx].highlight == 2) {
+ int i;
+
+ for (i = 3; i < COLS - 3 && i < (int)sizeof(buf); i++)
+ buf[i] = '-';
+ buf[i] = '\0';
+ } else
+ g_strlcpy(buf, " ", sizeof(buf));
return buf;
}
- return NULL;
+ if (help_text[idx].text)
+ g_snprintf(buf, sizeof(buf),
+ "%20s : %s ",
+ get_key_names(help_text[idx].command, TRUE),
+ _(help_text[idx].text));
+ else
+ g_snprintf(buf, sizeof(buf),
+ "%20s : %s ",
+ get_key_names(help_text[idx].command, TRUE),
+ get_key_description(help_text[idx].command));
+ return buf;
}
static void