blob: 08c0a3a9228ca4089603421a558abd386224d12b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#include "match.h"
#include <stdlib.h>
struct leg *leg_init(int points, char *name)
{
struct leg *l = calloc(1, sizeof(*l));
l->name = name;
l->start = l->rem = points;
l->visits = calloc(1000, sizeof(*(l->visits))); // FIXME
return l;
}
void leg_free(struct leg *l)
{
for (int i = 0; i < l->n_visits; ++i) {
if (l->visits[i].darts)
free(l->visits[i].darts);
if (l->visits[i].ccoords)
free(l->visits[i].ccoords);
}
free(l->visits);
free(l);
}
|