From 6461e2f5444d190ea9283c1ca8b05af2cde0ea23 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 18 Mar 2026 10:47:20 +0000 Subject: [PATCH] simulation: make a_b_concat a static --- src/simulation.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/simulation.c b/src/simulation.c index 9d179cc..001afc9 100644 --- a/src/simulation.c +++ b/src/simulation.c @@ -38,6 +38,7 @@ void simulation_mutate(simulation_t *sim) #endif } +static struct ProgramConcat *a_b_concat = NULL; void simulation_iterate(simulation_t *sim) { u64 a = 0, b = 0; @@ -48,12 +49,15 @@ void simulation_iterate(simulation_t *sim) } // Perform the reaction - struct ProgramConcat *a_b_concat = calloc(1, sizeof(*a_b_concat)); + if (!a_b_concat) + { + a_b_concat = calloc(1, sizeof(*a_b_concat)); + } + memset(a_b_concat, 0, sizeof(*a_b_concat)); program_concat(a_b_concat, sim->memory + (a * SIZEOF_PROGRAM), sim->memory + (b * SIZEOF_PROGRAM)); program_execute(a_b_concat); program_split(a_b_concat); - free(a_b_concat); } bf_token get_op(const bf_token cell)