From 72fd885f4ff423d5351e3387867f2415f1ffc2d8 Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Tue, 25 Feb 2025 17:20:05 +0100 Subject: Transform output format to a global state This commit removes the format parameter from the mp_check object and creates a module global variable instead. This prevents thread safe usage of different mp_check objects which should likely not present a big problem for now. The reason for this change is effectively the very same, the format was lost if an exit was triggered by a signal handler (timeout in this example). --- lib/output.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/output.h') diff --git a/lib/output.h b/lib/output.h index ffc36f53..2bdfa074 100644 --- a/lib/output.h +++ b/lib/output.h @@ -35,6 +35,12 @@ typedef enum output_format { #define MP_FORMAT_DEFAULT MP_FORMAT_MULTI_LINE +/* + * Format related functions + */ + void mp_set_format(mp_output_format format); + mp_output_format mp_get_format(void); + /* * The main state object of a plugin. Exists only ONCE per plugin. * This is the "root" of a tree of singular checks. @@ -42,7 +48,6 @@ typedef enum output_format { * in the first layer of subchecks */ typedef struct { - mp_output_format format; // The output format char *summary; // Overall summary, if not set a summary will be automatically generated mp_subcheck_list *subchecks; } mp_check; -- cgit v1.2.3-74-g34f1