summaryrefslogtreecommitdiff
path: root/comp.c
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-04-30 05:28:06 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-04-30 05:28:06 -0700
commit8921ce29627b45d78d1870d550418fc3d13dcdbe (patch)
tree1b5b37a317c93d55247ac3da719a8dcd8eaf072b /comp.c
parentfbdb393ae1e2ea5d368e4dda1577a10715e26a75 (diff)
downloaddartboat-8921ce29627b45d78d1870d550418fc3d13dcdbe.tar.gz
dartboat-8921ce29627b45d78d1870d550418fc3d13dcdbe.tar.xz
grow memory for visits as needed
Diffstat (limited to 'comp.c')
-rw-r--r--comp.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/comp.c b/comp.c
index 9427363..7b2c575 100644
--- a/comp.c
+++ b/comp.c
@@ -82,6 +82,8 @@ struct segment next_dart(int rem, int darts_in_hand)
void comp_visit(struct leg *l)
{
+ if (l->n_visits == l->size_visits)
+ leg_grow_visits(l);
struct visit *v = l->visits + l->n_visits++;
v->darts = calloc(3, sizeof(*(v->darts)));
v->ccoords = calloc(3, sizeof(*(v->ccoords)));