]> git.ipfire.org Git - collecty.git/commitdiff
graphs: Consolidate macros with and without label
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 3 Oct 2025 14:54:27 +0000 (14:54 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 3 Oct 2025 14:54:27 +0000 (14:54 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/daemon/graphs/graph.h

index 04b033a2f37b63a52c2927fa3c4713f013988c2e..38a918f47747e0fd6202be1c838e7fc3156a58d1 100644 (file)
 // Include utils
 #include "../util.h"
 
-#define SCRIPT(args, def) \
+#define SCRIPT(args, def, ...) \
        do { \
-               int __r = collecty_args_push(args, def); \
+               int __r = collecty_args_push(args, def, ##__VA_ARGS__); \
                if (__r < 0) \
                        return __r; \
        } while(0)
 
-#define SCRIPT_WITH_LABEL(args, def, label) \
-       do { \
-               int __r = collecty_args_push(args, def, label); \
-               if (__r < 0) \
-                       return __r; \
-       } while (0)
-
 #define EMPTY_LINE             "COMMENT: \\n"
 
 // Labels are 30 characters wide
@@ -69,7 +62,7 @@
        SCRIPT(args, what ":" field color __VA_ARGS__)
 
 #define DRAW_WITH_LABEL(args, what, field, color, label, ...) \
-       SCRIPT_WITH_LABEL(args, what ":" field color ":" LABEL __VA_ARGS__, label)
+       SCRIPT(args, what ":" field color ":" LABEL __VA_ARGS__, label)
 
 // Modifiers for lines
 #define DASHES                 ":dashes"
@@ -77,7 +70,7 @@
 
 // Add something to the legend of the graph
 #define PRINT(args, field, ...)                                        SCRIPT(args, "GPRINT:" field ":" __VA_ARGS__)
-#define PRINT_HEADER(args, label, ...)                 SCRIPT_WITH_LABEL(args, "COMMENT:" COLUMN __VA_ARGS__, label)
+#define PRINT_HEADER(args, label, ...)                 SCRIPT(args, "COMMENT:" COLUMN __VA_ARGS__, label)
 #define PRINT_EMPTY_LABEL(args, ...)                   SCRIPT(args, "COMMENT:                                " __VA_ARGS__)
 #define PRINT_NOTHING(args, ...)                               SCRIPT(args, "COMMENT:                " __VA_ARGS__)
 #define PRINT_INTEGER(args, field, ...)                        PRINT(args, field, INTEGER __VA_ARGS__)