mirror of
git://projects.qi-hardware.com/cae-tools.git
synced 2024-12-23 03:36:27 +02:00
45 lines
712 B
C
45 lines
712 B
C
/*
|
|
* p2d_free.c - Deallocate polygons
|
|
*
|
|
* Written 2012 by Werner Almesberger
|
|
* Copyright 2012 Werner Almesberger
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 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;
|
|
}
|
|
}
|