summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8a4cbdf)
raw | patch | inline | side by side (parent: 8a4cbdf)
author | Max Kellermann <max.kellermann@gmail.com> | |
Tue, 21 Mar 2017 21:28:14 +0000 (22:28 +0100) | ||
committer | Max Kellermann <max.kellermann@gmail.com> | |
Tue, 21 Mar 2017 21:28:14 +0000 (22:28 +0100) |
src/wreadln.c | patch | blob | history |
diff --git a/src/wreadln.c b/src/wreadln.c
index f45e474e1e2107f7986f8c66cb6819ab32578ab7..4dde082aa2948e78f9ef4f38619188c2f940cfe8 100644 (file)
--- a/src/wreadln.c
+++ b/src/wreadln.c
*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;
}
}