summaryrefslogtreecommitdiff
path: root/web/web_scoreboard.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_scoreboard.c
parent9a02c0367351c311734f42ab2afe2b377ca12908 (diff)
downloaddartboat-9edcd68e7ddcdc4deca8c07b5b1c3c59cef13255.tar.gz
dartboat-9edcd68e7ddcdc4deca8c07b5b1c3c59cef13255.tar.xz
pregenerate segment names to avoid constant mallocs
Diffstat (limited to 'web/web_scoreboard.c')
-rw-r--r--web/web_scoreboard.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/web/web_scoreboard.c b/web/web_scoreboard.c
index 2e998cc..ed25b33 100644
--- a/web/web_scoreboard.c
+++ b/web/web_scoreboard.c
@@ -262,12 +262,9 @@ static const char *points_class(int pts)
static void buf_darts(char *buf, size_t size, struct visit *v)
{
char *ptr = buf;
- for (int j = 0; j < v->n_darts; ++j) {
- char *n = segment_name(v->darts[j]);
+ for (int j = 0; j < v->n_darts; ++j)
ptr += snprintf(ptr, size - (ptr - buf),
- j == 0 ? "%s" : "-%s", n);
- free(n);
- }
+ j == 0 ? "%s" : "-%s", segment_name(v->darts[j]));
}
void draw_visits_dense()