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