[gtk/debug-envvars-cleanup] Define gdk_debug_message as a macro



commit 434a81e4cbe1e1d5be3ecf2e7cf59b98a82e8922
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Sep 23 14:53:17 2022 -0400

    Define gdk_debug_message as a macro
    
    This lets us use the debug macros in modules where
    a non-exported function won't work.

 gdk/gdk.c      | 13 -------------
 gdk/gdkdebug.h |  5 +++--
 2 files changed, 3 insertions(+), 15 deletions(-)
---
diff --git a/gdk/gdk.c b/gdk/gdk.c
index 62d125c3fc..babb4298ac 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -421,16 +421,3 @@ gdk_source_set_static_name_by_id (guint           tag,
 
   g_source_set_static_name (source, name);
 }
-
-void
-gdk_debug_message (const char *format,
-                   ...)
-{
-  va_list args;
-
-  va_start (args, format);
-  g_vfprintf (stderr, format, args);
-  va_end (args);
-
-  g_fprintf (stderr, "\n");
-}
diff --git a/gdk/gdkdebug.h b/gdk/gdkdebug.h
index 413d716114..b888d2c1fd 100644
--- a/gdk/gdkdebug.h
+++ b/gdk/gdkdebug.h
@@ -21,6 +21,7 @@
 #include <glib.h>
 
 #include "gdktypes.h"
+#include <glib/gstdio.h>
 
 G_BEGIN_DECLS
 
@@ -57,8 +58,8 @@ extern guint _gdk_debug_flags;
 GdkDebugFlags    gdk_display_get_debug_flags    (GdkDisplay       *display);
 void             gdk_display_set_debug_flags    (GdkDisplay       *display,
                                                  GdkDebugFlags     flags);
-void             gdk_debug_message              (const char       *format,
-                                                 ...) G_GNUC_PRINTF (1, 2);
+
+#define gdk_debug_message(format, ...) g_fprintf (stderr, format "\n" __VA_OPT__(,) __VA_ARGS__)
 
 #ifdef G_ENABLE_DEBUG
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]