From f23c124af2004917981087703b0e538b0197c725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20M=C3=BCller?= <> Date: Mon, 8 Aug 2022 20:12:50 +0200 Subject: [PATCH] Harmonize would_drop() replacement for g_log_writer_default_would_drop() Reuse a better to read would_drop() from ./testsuite/reftests/gtk-reftest.c in ./tools/gtk-builder-tool.c Fixed wrong indentation in ./testsuite/reftests/gtk-reftest.c --- testsuite/reftests/gtk-reftest.c | 2 +- tools/gtk-builder-tool.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/testsuite/reftests/gtk-reftest.c b/testsuite/reftests/gtk-reftest.c index a057a2e9d0..39b335e17e 100644 --- a/testsuite/reftests/gtk-reftest.c +++ b/testsuite/reftests/gtk-reftest.c @@ -513,7 +513,7 @@ log_writer (GLogLevelFlags log_level, } #endif - if (!would_drop (log_level, NULL)) + if (!would_drop (log_level, NULL)) return g_log_writer_standard_streams (log_level, fields, n_fields, user_data); return G_LOG_WRITER_HANDLED; diff --git a/tools/gtk-builder-tool.c b/tools/gtk-builder-tool.c index 278d3fb4db..15ee62dd20 100644 --- a/tools/gtk-builder-tool.c +++ b/tools/gtk-builder-tool.c @@ -55,9 +55,13 @@ static gboolean would_drop (GLogLevelFlags level, const char *domain) { +#if GLIB_CHECK_VERSION (2, 68, 0) + return g_log_writer_default_would_drop (level, domain); +#else return (level & (G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING)) == 0; +#endif } static GLogWriterOutput