Code

screen_help: removed the help_text_row_t typedef
[ncmpc.git] / src / screen_help.c
index eb738c360ce76d4df4a85227791289b5b40c1331..1d83bf77c3ba106644b2447f19b36a37afcca086 100644 (file)
 
 #include <glib.h>
 
-typedef struct {
+#include <assert.h>
+
+struct help_text_row {
        signed char highlight;
        command_t command;
        const char *text;
-} help_text_row_t;
+};
 
-static help_text_row_t help_text[] = {
+static const struct help_text_row help_text[] = {
        { 1, CMD_NONE, N_("Movement") },
        { 2, CMD_NONE, NULL },
        { 0, CMD_LIST_PREVIOUS, NULL },
@@ -177,8 +179,6 @@ static help_text_row_t help_text[] = {
 #endif
 };
 
-#define help_text_rows (sizeof(help_text) / sizeof(help_text[0]))
-
 static struct list_window *lw;
 
 static const char *
@@ -186,8 +186,7 @@ list_callback(unsigned idx, bool *highlight, G_GNUC_UNUSED char** second_column,
 {
        static char buf[512];
 
-       if (idx >= help_text_rows)
-               return NULL;
+       assert(idx < G_N_ELEMENTS(help_text));
 
        if (help_text[idx].highlight)
                *highlight = true;
@@ -230,8 +229,7 @@ help_init(WINDOW *w, int cols, int rows)
 static void
 help_resize(int cols, int rows)
 {
-  lw->cols = cols;
-  lw->rows = rows;
+       list_window_resize(lw, cols, rows);
 }
 
 static void