summaryrefslogtreecommitdiffstats
path: root/epan/conversation_debug.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:34:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:34:10 +0000
commite4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc (patch)
tree68cb5ef9081156392f1dd62a00c6ccc1451b93df /epan/conversation_debug.h
parentInitial commit. (diff)
downloadwireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.tar.xz
wireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.zip
Adding upstream version 4.2.2.upstream/4.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'epan/conversation_debug.h')
-rw-r--r--epan/conversation_debug.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/epan/conversation_debug.h b/epan/conversation_debug.h
new file mode 100644
index 00000000..2160b855
--- /dev/null
+++ b/epan/conversation_debug.h
@@ -0,0 +1,56 @@
+/** @file
+ * A file of debug printing stuff for conversation-related things,
+ * although really anything can use this so long as it includes this
+ * header file and defines DEBUG_CONVERSATION in conversation.c
+ *
+ * define DEBUG_CONVERSATION before including this file to turn on printing
+ * and also define it in conversation.c (because it has the indent variable)
+ *
+ * By Hadriel Kaplan <hadrielk at yahoo dot com>
+ * Copyright 2014 Hadriel Kaplan
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef _CONVERSATION_DEBUG_H
+#define _CONVERSATION_DEBUG_H
+
+#ifdef DEBUG_CONVERSATION
+
+#include <stdio.h>
+#include "to_str.h"
+
+extern int _debug_conversation_indent; /* the instance is in conversation.c */
+
+#define DINDENT() _debug_conversation_indent += 4
+#define DENDENT() _debug_conversation_indent -= 4
+
+#define DPRINT(arg) \
+ g_printerr("%*.*s%s: ", \
+ _debug_conversation_indent,_debug_conversation_indent," ", \
+ G_STRLOC); \
+g_printerr arg; \
+g_printerr("\n")
+
+#define DPRINT2(arg) \
+ g_printerr("%*.*s", \
+ _debug_conversation_indent,_debug_conversation_indent," "); \
+ g_printerr arg; \
+ g_printerr("\n")
+
+#define DINSTR(arg) arg
+
+#else /* !DEBUG_CONVERSATION */
+
+/* a hack to let these defines be used with trailing semi-colon and not
+ * cause gcc extra-check pedantic warnings for extra colons
+ */
+#define DINDENT() (void)0
+#define DENDENT() (void)0
+#define DPRINT(arg) (void)0
+#define DPRINT2(arg) (void)0
+#define DINSTR(arg) (void)0
+
+#endif /* DEBUG_CONVERSATION */
+
+#endif /* _CONVERSATION_DEBUG_H */