From ec35c6eb6a8890c6048e5f952b0493a8bf83ed86 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Thu, 1 Jun 2023 12:28:30 -0700 Subject: modules/rkt: variadic warpper for sync_get_track() Preparatory commit for adding scenes and a $rkt_setup_path:scene track for selecting them. This will also likely replace the whole track_name allocation/construction in rkt_pipe_t since we don't actually make use of that name after getting the track (except maybe for debugging purposes) --- src/modules/rkt/rkt.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src') diff --git a/src/modules/rkt/rkt.c b/src/modules/rkt/rkt.c index 77b3b49..41c47ad 100644 --- a/src/modules/rkt/rkt.c +++ b/src/modules/rkt/rkt.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -47,6 +48,27 @@ typedef struct rkt_setup_t { } rkt_setup_t; +/* variadic helper wrapping librocket's sync_get_track() */ +static const struct sync_track * sync_get_trackf(struct sync_device *device, const char *format, ...) +{ + char buf[4096]; + size_t len; + va_list ap; + + assert(device); + assert(format); + + va_start(ap, format); + len = vsnprintf(buf, sizeof(buf), format, ap); + va_end(ap); + + if (len >= sizeof(buf)) + return NULL; + + return sync_get_track(device, buf); +} + + static til_module_context_t * rkt_create_context(const til_module_t *module, til_stream_t *stream, unsigned seed, unsigned ticks, unsigned n_cpus, til_setup_t *setup) { rkt_context_t *ctxt; -- cgit v1.2.3