summaryrefslogtreecommitdiff
path: root/match.c
diff options
context:
space:
mode:
Diffstat (limited to 'match.c')
-rw-r--r--match.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/match.c b/match.c
new file mode 100644
index 0000000..17ce3b1
--- /dev/null
+++ b/match.c
@@ -0,0 +1,22 @@
+#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);
+ free(l->visits);
+ free(l);
+}