grid: refactor: break out allocation of ‘extra’ member to separate function

This commit is contained in:
Daniel Eklöf 2021-02-14 20:52:26 +01:00
parent 7f13d0084e
commit a0b977fcee
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

9
grid.c
View file

@ -580,11 +580,16 @@ grid_resize_and_reflow(
tll_free(tracking_points);
}
void
grid_row_add_uri_range(struct row *row, struct row_uri_range range)
static void
ensure_row_has_extra_data(struct row *row)
{
if (row->extra == NULL)
row->extra = xcalloc(1, sizeof(*row->extra));
}
void
grid_row_add_uri_range(struct row *row, struct row_uri_range range)
{
ensure_row_has_extra_data(row);
tll_push_back(row->extra->uri_ranges, range);
}