From bfc97788f081584ced9cd35d85b69b3fec6b907c Mon Sep 17 00:00:00 2001
From: Nikias Bassen
Date: Tue, 7 Feb 2023 12:47:10 +0100
Subject: Fix build without --enable-debug

---
 include/plist/plist.h | 1 +
 src/bplist.c          | 2 ++
 src/jplist.c          | 2 ++
 src/oplist.c          | 2 ++
 src/xplist.c          | 2 ++
 5 files changed, 9 insertions(+)

diff --git a/include/plist/plist.h b/include/plist/plist.h
index f955d5e..2e04b1d 100644
--- a/include/plist/plist.h
+++ b/include/plist/plist.h
@@ -1096,6 +1096,7 @@ extern "C"
 
     /**
      * Set debug level for the format parsers.
+     * @note This function does nothing if libplist was not configured with --enable-debug .
      *
      * @param debug Debug level. Currently, only 0 (off) and 1 (enabled) are supported.
      */
diff --git a/src/bplist.c b/src/bplist.c
index 72040cc..d29d499 100644
--- a/src/bplist.c
+++ b/src/bplist.c
@@ -229,7 +229,9 @@ void plist_bin_deinit(void)
 
 void plist_bin_set_debug(int debug)
 {
+#if DEBUG
     plist_bin_debug = debug;
+#endif
 }
 
 static plist_t parse_bin_node_at_index(struct bplist_data *bplist, uint32_t node_index);
diff --git a/src/jplist.c b/src/jplist.c
index 8ed7398..047b423 100644
--- a/src/jplist.c
+++ b/src/jplist.c
@@ -66,7 +66,9 @@ void plist_json_deinit(void)
 
 void plist_json_set_debug(int debug)
 {
+#ifdef DEBUG
     plist_json_debug = debug;
+#endif
 }
 
 #ifndef HAVE_STRNDUP
diff --git a/src/oplist.c b/src/oplist.c
index 1781962..a750767 100644
--- a/src/oplist.c
+++ b/src/oplist.c
@@ -65,7 +65,9 @@ void plist_ostep_deinit(void)
 
 void plist_ostep_set_debug(int debug)
 {
+#if DEBUG
     plist_ostep_debug = debug;
+#endif
 }
 
 #ifndef HAVE_STRNDUP
diff --git a/src/xplist.c b/src/xplist.c
index bd506fb..a0ab6d3 100644
--- a/src/xplist.c
+++ b/src/xplist.c
@@ -104,7 +104,9 @@ void plist_xml_deinit(void)
 
 void plist_xml_set_debug(int debug)
 {
+#if DEBUG
     plist_xml_debug = debug;
+#endif
 }
 
 static size_t dtostr(char *buf, size_t bufsize, double realval)
-- 
cgit v1.1-32-gdbae