diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2021-02-07 13:52:04 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-02-08 09:09:59 +0000 |
| commit | 4bad85b59334467ac839ed2dd91abb6625bc5b89 (patch) | |
| tree | 58bc014c759d125b9c143283c5502219013e5f77 /url-mode.c | |
| parent | Merge branch 'url-detection' (diff) | |
misc: when free:ing tll lists, prefer tll_remove() over tll_free()
In many places we have the following pattern:
tll_foreach(list, it)
free(it->item.thing);
tll_free(list);
Since all tll functions are macros, and thus inlined, and since
tll_free in itself expands to a tll_foreach(), the above pattern
expands to more native code than necessary.
This is somewhat smaller:
tll_foreach(list, it) {
free(it->item.thing);
tll_remove(list, it);
}
Diffstat (limited to 'url-mode.c')
| -rw-r--r-- | url-mode.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -540,15 +540,15 @@ urls_reset(struct terminal *term) wl_subsurface_destroy(it->item.sub_surf); if (it->item.surf != NULL) wl_surface_destroy(it->item.surf); + tll_remove(term->window->urls, it); } - tll_free(term->window->urls); } tll_foreach(term->urls, it) { tag_cells_for_url(term, &it->item, false); url_destroy(&it->item); + tll_remove(term->urls, it); } - tll_free(term->urls); memset(term->url_keys, 0, sizeof(term->url_keys)); render_refresh(term); |
