diff --git a/src/wreadln.c b/src/wreadln.c
index dc0fe627094f63b66290ca4deff6f84ece8e0e83..95267e28d539d28a79b77cf734c23e1a67320fcb 100644 (file)
--- a/src/wreadln.c
+++ b/src/wreadln.c
/* 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
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)
{
*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;
}
}