From 9edcd68e7ddcdc4deca8c07b5b1c3c59cef13255 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Wed, 25 May 2022 00:57:32 -0700 Subject: pregenerate segment names to avoid constant mallocs --- web/web_control.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'web/web_control.c') 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]; -- cgit v1.2.3-70-g09d2