aboutsummaryrefslogtreecommitdiffstats
path: root/epan/epan.c
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2021-10-15 18:34:33 +0100
committerJoão Valverde <j@v6e.pt>2021-11-14 21:00:59 +0000
commited8a02af172200c037a3ddf3d63eea9c2f587957 (patch)
treebf54b5e8115f7f4892165952a639981d3a0beb45 /epan/epan.c
parent6630fd52608ca31350798567f9fafcb24532adc8 (diff)
dfilter: Add support for PCRE2
PCRE2 is the future of PCRE. The only advantage of GRegex is that it comes bundled with GLib, which is not an advantage at all. PCRE2 is widely available, the GRegex abstractions layer are not a good fit and abstract things that don't need abstracting or that we could handle better ourselves, there are open bugs (#12997) and maintenance is spotty at best. GRegex comes with many of the problems of bundled code, aggravated by the fact that it completely falls outside of our control.
Diffstat (limited to 'epan/epan.c')
-rw-r--r--epan/epan.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/epan/epan.c b/epan/epan.c
index 85a02ed4ac..1beb8d8101 100644
--- a/epan/epan.c
+++ b/epan/epan.c
@@ -97,6 +97,10 @@
#include <libxml/parser.h>
#endif
+#ifdef HAVE_PCRE2
+#include <pcre2.h>
+#endif
+
#ifndef _WIN32
#include <signal.h>
#endif
@@ -805,6 +809,13 @@ epan_get_compiled_version_info(GString *str)
g_string_append(str, ", without MaxMind DB resolver");
#endif /* HAVE_MAXMINDDB */
+ /* PCRE2 */
+#ifdef HAVE_PCRE2
+ g_string_append(str, ", with PCRE2");
+#else
+ g_string_append(str, ", without PCRE2");
+#endif /* HAVE_PCRE2 */
+
/* nghttp2 */
#ifdef HAVE_NGHTTP2
g_string_append(str, ", with nghttp2 " NGHTTP2_VERSION);
@@ -872,6 +883,17 @@ epan_get_runtime_version_info(GString *str)
/* Gcrypt */
g_string_append_printf(str, ", with Gcrypt %s", gcry_check_version(NULL));
+ /* PCRE2 */
+#ifdef HAVE_PCRE2
+ int pcre2_size = pcre2_config(PCRE2_CONFIG_VERSION, NULL);
+ if (pcre2_size > 0 && pcre2_size <= 255) {
+ char *pcre2_str = g_malloc0(pcre2_size + 1);
+ pcre2_config(PCRE2_CONFIG_VERSION, pcre2_str);
+ g_string_append_printf(str, ", with PCRE2 %s", pcre2_str);
+ g_free(pcre2_str);
+ }
+#endif /* HAVE_PCRE2 */
+
/* nghttp2 */
#if NGHTTP2_VERSION_AGE >= 1
nghttp2_info *nghttp2_ptr = nghttp2_version(0);