From eda5d1668dbc8529453b7128c4ec2d51aeb1e783 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Fri, 15 Apr 2022 01:18:36 -0700 Subject: split code into multiple files --- match.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 match.c (limited to 'match.c') 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 + +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); +} -- cgit v1.2.3-70-g09d2