1
0
mirror of git://projects.qi-hardware.com/cae-tools.git synced 2024-12-23 04:13:20 +02:00
cae-tools/poly2d/p2d_free.c
2012-05-06 23:51:38 -03:00

45 lines
703 B
C

/*
* p2d_free.c - Deallocate polygons
*
* Written 2012 by Werner Almesberger
* Copyright 2012 Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <stdlib.h>
#include "poly2d.h"
void p2d_free(struct p2d *p)
{
struct v2d *v, *next;
v = p->v;
while (v) {
next = v->next;
free(v);
v = next;
if (v == p->v)
break;
}
free(p);
}
void p2d_free_all(struct p2d *p)
{
struct p2d *next;
while (p) {
next = p->next;
p2d_free(p);
p = next;
}
}