url-mode: add new (public) function url_list_destroy()

This commit is contained in:
Daniel Eklöf 2022-06-17 18:44:54 +02:00
parent 116b8fa635
commit 8b882b3a13
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 14 additions and 4 deletions

View file

@ -826,6 +826,15 @@ url_destroy(struct url *url)
free(url->key); free(url->key);
} }
void
url_list_destroy(url_list_t *urls)
{
tll_foreach(*urls, it) {
url_destroy(&it->item);
tll_remove(*urls, it);
}
}
void void
urls_reset(struct terminal *term) urls_reset(struct terminal *term)
{ {
@ -855,11 +864,9 @@ urls_reset(struct terminal *term)
} }
} }
tll_foreach(term->urls, it) { tll_foreach(term->urls, it)
tag_cells_for_url(term, &it->item, false); tag_cells_for_url(term, &it->item, false);
url_destroy(&it->item); url_list_destroy(&term->urls);
tll_remove(term->urls, it);
}
term->urls_show_uri_on_jump_label = false; term->urls_show_uri_on_jump_label = false;
memset(term->url_keys, 0, sizeof(term->url_keys)); memset(term->url_keys, 0, sizeof(term->url_keys));

View file

@ -18,6 +18,9 @@ void urls_collect(
void url_activate(struct seat *seat, struct terminal *term, void url_activate(struct seat *seat, struct terminal *term,
const struct url *url, uint32_t serial); const struct url *url, uint32_t serial);
void url_list_destroy(url_list_t *urls);
void urls_assign_key_combos(const struct config *conf, url_list_t *urls); void urls_assign_key_combos(const struct config *conf, url_list_t *urls);
void urls_render(struct terminal *term); void urls_render(struct terminal *term);