c->comps.completions, source, (Comp_Func)g_str_has_prefix, &input[5], ":set "
);
} else if (!strncmp(input, ":open ", 6)) {
- source = url_history_get_all();
+ url_history_get_all(&source);
c->comps.completions = completion_init_completion(
c,
c->comps.completions, source, (Comp_Func)util_strcasestr, &input[6], ":open "
);
g_list_free(source);
} else if (!strncmp(input, ":tabopen ", 9)) {
- source = url_history_get_all();
+ url_history_get_all(&source);
c->comps.completions = completion_init_completion(
c,
c->comps.completions, source, (Comp_Func)util_strcasestr, &input[9], ":tabopen "
}
/**
- * Retrieves the ur history as ne allocated list.
+ * Appends the url history entries to given list.
*/
-GList* url_history_get_all(void)
+void url_history_get_all(GList** list)
{
- GList* out = NULL;
for (GList* link = core.behave.url_history; link; link = link->next) {
UrlHist* hi = (UrlHist*)link->data;
/* put only the url in the list - do not allocate new memory */
- out = g_list_prepend(out, hi->uri);
+ *list = g_list_prepend(*list, hi->uri);
}
- out = g_list_reverse(out);
- return out;
+ *list = g_list_reverse(*list);
}
static void url_history_free(UrlHist* item)
void url_history_init(void);
void url_history_cleanup(void);
void url_history_add(const char* url, const char* title);
-GList* url_history_get_all(void);
+void url_history_get_all(GList** list);
#endif /* end of include guard: _URL_HISTORY_H */