{
if (COMMAND_HISTORY_SIZE <= g_list_length(core.behave.history)) {
/* if list is too long - remove items from beginning */
- core.behave.history = g_list_delete_link(core.behave.history, g_list_first(core.behave.history));
+ GList* first = g_list_first(core.behave.history);
+ g_free((char*)first->data);
+ core.behave.history = g_list_delete_link(core.behave.history, first);
}
core.behave.history = g_list_append(core.behave.history, g_strdup(line));
}
GSList* link = keybind_find(keybind.mode, keybind.modkey, keybind.modmask, keybind.keyval);
if (link) {
+ keybind_free((Keybind*)link->data);
core.behave.keys = g_slist_delete_link(core.behave.keys, link);
}
GSList* list = searchengine_find(handle);
if (list) {
- Searchengine* s = (Searchengine*)list->data;
- g_free(s->handle);
- g_free(s->uri);
-
+ searchengine_free((Searchengine*)list->data);
core.behave.searchengines = g_slist_delete_link(core.behave.searchengines, list);
return TRUE;
void url_history_add(const char* url, const char* title)
{
/* uf the url is already in history, remove this entry */
+ /* TODO use g_list_find_custom for this task */
for (GList* link = core.behave.url_history; link; link = link->next) {
UrlHist* hi = (UrlHist*)link->data;
if (!g_strcmp0(url, hi->uri)) {
while (core.config.url_history_max < g_list_length(core.behave.url_history)) {
/* if list is too long - remove items from end */
- core.behave.url_history = g_list_delete_link(
- core.behave.url_history,
- g_list_last(core.behave.url_history)
- );
+ GList* last = g_list_last(core.behave.url_history);
+ url_history_free((UrlHist*)last->data);
+ core.behave.url_history = g_list_delete_link(core.behave.url_history, last);
}
UrlHist* item = g_new0(UrlHist, 1);