mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-18 22:05:25 -05:00
grid: add grid_free()
This commit is contained in:
parent
ebf8070244
commit
bb74fe3f7d
3 changed files with 18 additions and 14 deletions
14
grid.c
14
grid.c
|
|
@ -11,6 +11,20 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
|
|
||||||
|
void
|
||||||
|
grid_free(struct grid *grid)
|
||||||
|
{
|
||||||
|
for (int r = 0; r < grid->num_rows; r++)
|
||||||
|
grid_row_free(grid->rows[r]);
|
||||||
|
|
||||||
|
tll_foreach(grid->sixel_images, it) {
|
||||||
|
sixel_destroy(&it->item);
|
||||||
|
tll_remove(grid->sixel_images, it);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(grid->rows);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
grid_swap_row(struct grid *grid, int row_a, int row_b)
|
grid_swap_row(struct grid *grid, int row_a, int row_b)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
2
grid.h
2
grid.h
|
|
@ -4,6 +4,8 @@
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "terminal.h"
|
#include "terminal.h"
|
||||||
|
|
||||||
|
void grid_free(struct grid *grid);
|
||||||
|
|
||||||
void grid_swap_row(struct grid *grid, int row_a, int row_b);
|
void grid_swap_row(struct grid *grid, int row_a, int row_b);
|
||||||
struct row *grid_row_alloc(int cols, bool initialize);
|
struct row *grid_row_alloc(int cols, bool initialize);
|
||||||
void grid_row_free(struct row *row);
|
void grid_row_free(struct row *row);
|
||||||
|
|
|
||||||
16
terminal.c
16
terminal.c
|
|
@ -1437,12 +1437,8 @@ term_destroy(struct terminal *term)
|
||||||
mtx_unlock(&term->render.workers.lock);
|
mtx_unlock(&term->render.workers.lock);
|
||||||
|
|
||||||
free(term->vt.osc.data);
|
free(term->vt.osc.data);
|
||||||
for (int row = 0; row < term->normal.num_rows; row++)
|
grid_free(&term->normal);
|
||||||
grid_row_free(term->normal.rows[row]);
|
grid_free(&term->alt);
|
||||||
free(term->normal.rows);
|
|
||||||
for (int row = 0; row < term->alt.num_rows; row++)
|
|
||||||
grid_row_free(term->alt.rows[row]);
|
|
||||||
free(term->alt.rows);
|
|
||||||
|
|
||||||
tll_free(term->normal.scroll_damage);
|
tll_free(term->normal.scroll_damage);
|
||||||
tll_free(term->alt.scroll_damage);
|
tll_free(term->alt.scroll_damage);
|
||||||
|
|
@ -1490,14 +1486,6 @@ term_destroy(struct terminal *term)
|
||||||
tll_remove(term->ptmx_paste_buffers, it);
|
tll_remove(term->ptmx_paste_buffers, it);
|
||||||
}
|
}
|
||||||
|
|
||||||
tll_foreach(term->normal.sixel_images, it) {
|
|
||||||
sixel_destroy(&it->item);
|
|
||||||
tll_remove(term->normal.sixel_images, it);
|
|
||||||
}
|
|
||||||
tll_foreach(term->alt.sixel_images, it) {
|
|
||||||
sixel_destroy(&it->item);
|
|
||||||
tll_remove(term->alt.sixel_images, it);
|
|
||||||
}
|
|
||||||
sixel_fini(term);
|
sixel_fini(term);
|
||||||
|
|
||||||
urls_reset(term);
|
urls_reset(term);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue