tsimulation.c: copy new grains to simulation - granular - granular dynamics sim… | |
git clone git://src.adamsgaard.dk/granular | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit ef57b07c2e15ce74ff97b4923c847277af1032f3 | |
parent a83d57fbe2b6759ec904f4047e0460c83cd89dcf | |
Author: Anders Damsgaard <[email protected]> | |
Date: Thu, 8 Apr 2021 22:31:03 +0200 | |
simulation.c: copy new grains to simulation | |
Diffstat: | |
M simulation.c | 2 +- | |
1 file changed, 1 insertion(+), 1 deletion(-) | |
--- | |
diff --git a/simulation.c b/simulation.c | |
t@@ -57,7 +57,7 @@ sim_add_grain(struct simulation *sim, struct grain *g) | |
{ | |
if (!(sim->grains = xreallocarray(sim->grains, sim->ng + 1, sizeof(*g)… | |
err(1, "%s: sim.grains reallocarray", __func__); | |
- sim->grains[sim->ng++] = *g; | |
+ memcpy(&sim->grains[sim->ng++], g, sizeof(*g)); | |
free(g); | |
} | |