diff options
-rw-r--r-- | src/modules/rkt/rkt.c | 22 |
1 files changed, 22 insertions, 0 deletions
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 <stdarg.h> #include <stdlib.h> #include <string.h> #include <time.h> @@ -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; |