[buoh/cleanups: 19/31] Fix buoh_debug
- From: Jan Tojnar <jtojnar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [buoh/cleanups: 19/31] Fix buoh_debug
- Date: Wed, 23 Jan 2019 11:21:04 +0000 (UTC)
commit 2a7fd871774086ede4cf07342dac0350e30177fe
Author: Jan Tojnar <jtojnar gmail com>
Date: Sat Oct 6 23:01:44 2018 +0200
Fix buoh_debug
There were three problems, actually: First, NDEBUG means no debugging,
so the function should not be compiled out when the constant is NOT defined.
Second, Meson does not actually define the constant by default in release mode.
Last, the function passed a variable with the message directly to g_debug,
triggering -Werror=format-security check.
meson.build | 3 +++
src/buoh.c | 4 ++--
2 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/meson.build b/meson.build
index c7a4535..57f5f7e 100644
--- a/meson.build
+++ b/meson.build
@@ -3,6 +3,9 @@ project(
'c',
license: 'GPL2+',
version: '0.8.3',
+ default_options: [
+ 'b_ndebug=if-release',
+ ],
)
gnome = import('gnome')
diff --git a/src/buoh.c b/src/buoh.c
index f01f6a3..21319a4 100644
--- a/src/buoh.c
+++ b/src/buoh.c
@@ -64,7 +64,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (Buoh, buoh, G_TYPE_OBJECT)
void
buoh_debug (const gchar *format, ...)
{
-#ifdef NDEBUG
+#if !defined(NDEBUG)
va_list args;
gchar *string;
@@ -74,7 +74,7 @@ buoh_debug (const gchar *format, ...)
string = g_strdup_vprintf (format, args);
va_end (args);
- g_debug (string);
+ g_debug ("%s", string);
g_free (string);
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]