Code

release v0.29
[ncmpc.git] / src / wreadln.c
index f45e474e1e2107f7986f8c66cb6819ab32578ab7..95267e28d539d28a79b77cf734c23e1a67320fcb 100644 (file)
@@ -286,7 +286,7 @@ static inline void drawline(const struct wreadln *wr)
        doupdate();
 }
 
-#if defined(HAVE_CURSES_ENHANCED) || defined(ENABLE_MULTIBYTE)
+#if (defined(HAVE_CURSES_ENHANCED) || defined(ENABLE_MULTIBYTE)) && !defined(WIN32)
 static bool
 multibyte_is_complete(const char *p, size_t length)
 {
@@ -592,13 +592,15 @@ _wreadln(WINDOW *w,
                        *history = g_list_delete_link(*history, hcurrent);
                }
 
-               while (g_list_length(*history) > wrln_max_history_length) {
+               unsigned history_length = g_list_length(*history);
+               while (history_length > wrln_max_history_length) {
                        GList *first = g_list_first(*history);
 
                        /* remove the oldest history entry  */
                        g_free(first->data);
                        first->data = NULL;
                        *history = g_list_delete_link(*history, first);
+                       --history_length;
                }
        }