From: Michael Tremer Date: Wed, 29 Oct 2025 18:38:45 +0000 (+0000) Subject: graphs: Add convenience function to add multiple objects X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c77fec14d77be5b7a16fc334931ba137b92f397a;p=telemetry.git graphs: Add convenience function to add multiple objects Signed-off-by: Michael Tremer --- diff --git a/src/daemon/graph.c b/src/daemon/graph.c index f93176d..cfd1e47 100644 --- a/src/daemon/graph.c +++ b/src/daemon/graph.c @@ -207,6 +207,20 @@ ERROR: return r; } +int td_graph_require_sources(td_graph* self, + td_args* args, const char* name, const char** objects) { + int r; + + // Add objects + for (const char** o = objects; *o; o++) { + r = td_graph_require_source(self, args, name, *o); + if (r < 0) + return r; + } + + return 0; +} + static int td_graph_render_title(td_graph* self, const char* object, const td_graph_render_options* options, td_args* args) { char title[TITLE_MAX] = ""; diff --git a/src/daemon/graph.h b/src/daemon/graph.h index 739bc5e..8b58d22 100644 --- a/src/daemon/graph.h +++ b/src/daemon/graph.h @@ -71,6 +71,8 @@ char* td_graph_get_bus_path(td_graph* self); int td_graph_require_source(td_graph* self, td_args* args, const char* name, const char* object); +int td_graph_require_sources(td_graph* self, + td_args* args, const char* name, const char** objects); typedef struct td_graph_render_options { // Output Format