]> git.ipfire.org Git - collecty.git/commitdiff
graphs: Add convenience function to add multiple objects
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 29 Oct 2025 18:38:45 +0000 (18:38 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 29 Oct 2025 18:38:45 +0000 (18:38 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/daemon/graph.c
src/daemon/graph.h

index f93176d46868ba5a9992d2d7f6d15301184c0d2e..cfd1e47dca61d571fb2aa8be0ce2465b9f5f720f 100644 (file)
@@ -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] = "";
index 739bc5e635b8f7998536dfb9de963d10478c8132..8b58d22a0a61a6328eb3aed9fc09c7a123617158 100644 (file)
@@ -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