grid: refactor: first step towards a more generic range handling

This commit is contained in:
Daniel Eklöf 2024-06-23 13:29:12 +02:00
parent cbe399ecd9
commit 20923bb2e8
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
4 changed files with 135 additions and 81 deletions

20
grid.h
View file

@ -89,9 +89,25 @@ void grid_row_uri_range_put(
void grid_row_uri_range_erase(struct row *row, int start, int end);
static inline void
grid_row_uri_range_destroy(struct row_uri_range *range)
grid_row_uri_range_destroy(struct row_range *range)
{
free(range->uri);
free(range->uri.uri);
}
static inline void
grid_row_range_destroy(struct row_range *range, enum row_range_type type)
{
switch (type) {
case ROW_RANGE_URI: grid_row_uri_range_destroy(range); break;
}
}
static inline void
grid_row_ranges_destroy(struct row_ranges *ranges, enum row_range_type type)
{
for (int i = 0; i < ranges->count; i++) {
grid_row_range_destroy(&ranges->v[i], type);
}
}
static inline void