grid: add new function, grid_row_reset_extra()

This function resets (free:s) all ‘extra’ data associated with a row.
This commit is contained in:
Daniel Eklöf 2021-02-14 20:32:38 +01:00
parent 0e6b1f7508
commit 00977fcc15
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

15
grid.h
View file

@ -72,3 +72,18 @@ grid_row_in_view(struct grid *grid, int row_no)
xassert(row != NULL);
return row;
}
static inline void
grid_row_reset_extra(struct row *row)
{
if (likely(row->extra == NULL))
return;
tll_foreach(row->extra->uri_ranges, it) {
free(it->item.uri);
tll_remove(row->extra->uri_ranges, it);
}
free(row->extra);
row->extra = NULL;
}