diff --git a/poly2d/f2d_tri.c b/poly2d/f2d_tri.c index 418ce88..7d15a95 100644 --- a/poly2d/f2d_tri.c +++ b/poly2d/f2d_tri.c @@ -11,6 +11,8 @@ */ +#include + #include "poly2d.h" #include "p2d_hsort.h" @@ -40,3 +42,15 @@ struct f2d *f2d_tri(const struct p2d *p) p2d_hier_free(t, 0); return res; } + + +void f2d_free_all(struct f2d *f) +{ + struct f2d *next; + + while (f) { + next = f->next; + free(f); + f = next; + } +} diff --git a/poly2d/poly2d.h b/poly2d/poly2d.h index 4233c13..e802386 100644 --- a/poly2d/poly2d.h +++ b/poly2d/poly2d.h @@ -171,6 +171,7 @@ void f2d_tri_holes_append(const struct p2d *p, const struct p2d *holes, struct f2d ***last); struct f2d *f2d_tri_holes(const struct p2d *p, const struct p2d *holes); struct f2d *f2d_tri(const struct p2d *p); +void f2d_free_all(struct f2d *f); struct p2d *p2d_read_gnuplot(FILE *file); int p2d_write_gnuplot(FILE *file, const struct p2d *p);