[PATCH 3/8] wireshark: Move WIRESHARK_VERSION macro definition

Michal Privoznik via Devel posted 8 patches 2 weeks ago
[PATCH 3/8] wireshark: Move WIRESHARK_VERSION macro definition
Posted by Michal Privoznik via Devel 2 weeks ago
From: Michal Privoznik <mprivozn@redhat.com>

Soon, other parts of the wireshark code will need to
differentiate wrt wireshark version. Therefore, move the
WIRESHARK_VERSION macro definition among with its deps into
packet-libvirt.h.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 tools/wireshark/src/packet-libvirt.h | 14 ++++++++++++++
 tools/wireshark/src/plugin.c         | 14 --------------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/tools/wireshark/src/packet-libvirt.h b/tools/wireshark/src/packet-libvirt.h
index 14e6e13696..15cfcb0534 100644
--- a/tools/wireshark/src/packet-libvirt.h
+++ b/tools/wireshark/src/packet-libvirt.h
@@ -19,5 +19,19 @@
 
 #pragma once
 
+#ifdef WITH_WS_VERSION
+# include <wireshark/ws_version.h>
+#else
+# include <wireshark/config.h>
+# define WIRESHARK_VERSION_MAJOR VERSION_MAJOR
+# define WIRESHARK_VERSION_MINOR VERSION_MINOR
+# define WIRESHARK_VERSION_MICRO VERSION_MICRO
+#endif
+
+#define WIRESHARK_VERSION \
+    ((WIRESHARK_VERSION_MAJOR * 1000 * 1000) + \
+     (WIRESHARK_VERSION_MINOR * 1000) + \
+     (WIRESHARK_VERSION_MICRO))
+
 void proto_register_libvirt(void);
 void proto_reg_handoff_libvirt(void);
diff --git a/tools/wireshark/src/plugin.c b/tools/wireshark/src/plugin.c
index 19b25e7b1a..64317b5280 100644
--- a/tools/wireshark/src/plugin.c
+++ b/tools/wireshark/src/plugin.c
@@ -12,15 +12,6 @@
 
 #include <config.h>
 
-#ifdef WITH_WS_VERSION
-# include <wireshark/ws_version.h>
-#else
-# include <wireshark/config.h>
-# define WIRESHARK_VERSION_MAJOR VERSION_MAJOR
-# define WIRESHARK_VERSION_MINOR VERSION_MINOR
-# define WIRESHARK_VERSION_MICRO VERSION_MICRO
-#endif
-
 #define HAVE_PLUGINS 1
 #include <wireshark/epan/proto.h>
 /* plugins are DLLs */
@@ -32,11 +23,6 @@
 /* Let the plugin version be the version of libvirt */
 #define PLUGIN_VERSION VERSION
 
-#define WIRESHARK_VERSION \
-    ((WIRESHARK_VERSION_MAJOR * 1000 * 1000) + \
-     (WIRESHARK_VERSION_MINOR * 1000) + \
-     (WIRESHARK_VERSION_MICRO))
-
 #if WIRESHARK_VERSION < 2005000
 
 WS_DLL_PUBLIC_DEF const gchar version[] = VERSION;
-- 
2.49.1
Re: [PATCH 3/8] wireshark: Move WIRESHARK_VERSION macro definition
Posted by Peter Krempa via Devel 2 weeks ago
On Tue, Oct 14, 2025 at 08:31:42 +0200, Michal Privoznik via Devel wrote:
> From: Michal Privoznik <mprivozn@redhat.com>
> 
> Soon, other parts of the wireshark code will need to
> differentiate wrt wireshark version. Therefore, move the
> WIRESHARK_VERSION macro definition among with its deps into
> packet-libvirt.h.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  tools/wireshark/src/packet-libvirt.h | 14 ++++++++++++++
>  tools/wireshark/src/plugin.c         | 14 --------------
>  2 files changed, 14 insertions(+), 14 deletions(-)

Reviewed-by: Peter Krempa <pkrempa@redhat.com>