From e4cbdffe282ab9b3bb346a963726484f1ed71b08 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 3 Dec 2018 20:43:07 +0100 Subject: [PATCH] output-mode: add new helper OUTPUT_MODE_IS_JSON() Just a pretty way to determine whether the selected output mode is a JSON output mode. --- src/shared/output-mode.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/shared/output-mode.h b/src/shared/output-mode.h index a3be8d668eb..00b60320567 100644 --- a/src/shared/output-mode.h +++ b/src/shared/output-mode.h @@ -24,6 +24,10 @@ typedef enum OutputMode { _OUTPUT_MODE_INVALID = -1 } OutputMode; +static inline bool OUTPUT_MODE_IS_JSON(OutputMode m) { + return IN_SET(m, OUTPUT_JSON, OUTPUT_JSON_PRETTY, OUTPUT_JSON_SSE, OUTPUT_JSON_SEQ); +} + /* The output flags definitions are shared by the logs and process tree output. Some apply to both, some only to the * logs output, others only to the process tree output. */ -- 2.47.3