summaryrefslogtreecommitdiff
path: root/web/web_control.c
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-25 00:57:32 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-25 00:58:15 -0700
commit9edcd68e7ddcdc4deca8c07b5b1c3c59cef13255 (patch)
tree1a7a0069e8d51709238d991dc43f0323ec32bb9c /web/web_control.c
parent9a02c0367351c311734f42ab2afe2b377ca12908 (diff)
downloaddartboat-9edcd68e7ddcdc4deca8c07b5b1c3c59cef13255.tar.gz
dartboat-9edcd68e7ddcdc4deca8c07b5b1c3c59cef13255.tar.xz
pregenerate segment names to avoid constant mallocs
Diffstat (limited to 'web/web_control.c')
-rw-r--r--web/web_control.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/web/web_control.c b/web/web_control.c
index a7a53cf..07d52b1 100644
--- a/web/web_control.c
+++ b/web/web_control.c
@@ -81,9 +81,8 @@ static void schedule_boat_visit_draws(struct leg *l, struct visit *v,
for (int i = 0; i < v->n_darts; ++i) {
pts += segment_points(v->darts[i]);
- char *seg_name = segment_name(v->darts[i]);
- len_str += sprintf(str + len_str, i ? "-%s" : "%s", seg_name);
- free(seg_name);
+ len_str += sprintf(str + len_str, i ? "-%s" : "%s",
+ segment_name(v->darts[i]));
struct ccoords c = v->ccoords[i];