Code

screen_queue: no typedef for completion_callback_data_t
[ncmpc.git] / src / screen_text.c
index 03a8fc57866bbba006b9d3ce7f6a2e39ea42371b..fc9cc98a7d98d1bd9d6e4100a333e7656c9f3366 100644 (file)
@@ -1,5 +1,5 @@
 /* ncmpc (Ncurses MPD Client)
- * (c) 2004-2010 The Music Player Daemon Project
+ * (c) 2004-2017 The Music Player Daemon Project
  * Project homepage: http://musicpd.org
  *
  * This program is free software; you can redistribute it and/or modify
@@ -39,14 +39,13 @@ screen_text_clear(struct screen_text *text)
 void
 screen_text_append(struct screen_text *text, const char *str)
 {
-       const char *eol, *next;
-
        assert(str != NULL);
 
+       const char *eol;
        while ((eol = strchr(str, '\n')) != NULL) {
                char *line;
 
-               next = eol + 1;
+               const char *next = eol + 1;
 
                /* strip whitespace at end */
 
@@ -80,12 +79,12 @@ const char *
 screen_text_list_callback(unsigned idx, void *data)
 {
        const struct screen_text *text = data;
-       static char buffer[256];
-       char *value;
 
        assert(idx < text->lines->len);
 
-       value = utf8_to_locale(g_ptr_array_index(text->lines, idx));
+       char *value = utf8_to_locale(g_ptr_array_index(text->lines, idx));
+
+       static char buffer[256];
        g_strlcpy(buffer, value, sizeof(buffer));
        g_free(value);
 
@@ -94,7 +93,7 @@ screen_text_list_callback(unsigned idx, void *data)
 
 bool
 screen_text_cmd(struct screen_text *text,
-               G_GNUC_UNUSED struct mpdclient *c, command_t cmd)
+               gcc_unused struct mpdclient *c, command_t cmd)
 {
        if (list_window_scroll_cmd(text->lw, cmd)) {
                screen_text_repaint(text);