From: Michael Tremer Date: Fri, 3 Oct 2025 14:54:27 +0000 (+0000) Subject: graphs: Consolidate macros with and without label X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=551c4468fa1e8c0a6840da0580623f9964a0281b;p=collecty.git graphs: Consolidate macros with and without label Signed-off-by: Michael Tremer --- diff --git a/src/daemon/graphs/graph.h b/src/daemon/graphs/graph.h index 04b033a..38a918f 100644 --- a/src/daemon/graphs/graph.h +++ b/src/daemon/graphs/graph.h @@ -35,20 +35,13 @@ // 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__)