diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-05-25 00:57:32 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-05-25 00:58:15 -0700 |
commit | 9edcd68e7ddcdc4deca8c07b5b1c3c59cef13255 (patch) | |
tree | 1a7a0069e8d51709238d991dc43f0323ec32bb9c /dartboat.c | |
parent | 9a02c0367351c311734f42ab2afe2b377ca12908 (diff) | |
download | dartboat-9edcd68e7ddcdc4deca8c07b5b1c3c59cef13255.tar.gz dartboat-9edcd68e7ddcdc4deca8c07b5b1c3c59cef13255.tar.xz |
pregenerate segment names to avoid constant mallocs
Diffstat (limited to 'dartboat.c')
-rw-r--r-- | dartboat.c | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -21,11 +21,9 @@ void test_match(int start_points) struct visit *v = l->visits + i; printf("(%2d) %3d %3d", i+1, v->points, v->rem); - for (int j = 0; j < v->n_darts; ++j) { - char *n = segment_name(v->darts[j]); - printf(j == 0 ? " %4s" :" %4s", n); - free(n); - } + for (int j = 0; j < v->n_darts; ++j) + printf(j == 0 ? " %4s" : " %4s", + segment_name(v->darts[j])); printf("\n"); } |