diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2022-07-20 21:06:31 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2022-07-20 21:06:31 -0700 |
commit | b38db01c835fa222aa11ace3a2d84095fe2c3f83 (patch) | |
tree | 18464eac0c46a1e8a82f96faadc370066d8bf61c /src/modules/sparkler/particles.c | |
parent | b68ec04f86f83ba3d7926ffafc1d8a6456e72c05 (diff) |
modules/sparkler: s/rand/rand_r/ and wire up seed
This is a little contorted but not too bad. The input to
particles_new() is just a const conf struct, so instead of
passing in the seed value for particles_t to contain, a pointer
to where the seed lives is passed in via the conf. This requires
the caller to persist a seed somewhere outside the particles
instance, but at least in rototiller we already have that
conveniently in til_module_context_t.
Diffstat (limited to 'src/modules/sparkler/particles.c')
-rw-r--r-- | src/modules/sparkler/particles.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/modules/sparkler/particles.c b/src/modules/sparkler/particles.c index 2389e93..f6adf13 100644 --- a/src/modules/sparkler/particles.c +++ b/src/modules/sparkler/particles.c @@ -49,6 +49,8 @@ particles_t * particles_new(const particles_conf_t *conf) { particles_t *particles; + assert(conf && conf->seedp); + particles = calloc(1, sizeof(particles_t)); if (!particles) { return NULL; @@ -66,8 +68,7 @@ particles_t * particles_new(const particles_conf_t *conf) INIT_LIST_HEAD(&particles->active); - if (conf) - particles->conf = *conf; + particles->conf = *conf; return particles; } |