diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2011-08-23 09:25:06 +0000 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2011-08-23 09:25:06 +0000 |
commit | 5603cef9f2755f0826933e78f4e511bdc47d16b2 (patch) | |
tree | 49ff20550b874530e3e9ae8ca76219618cda97be | |
parent | b213104006167e21211f7aed20754cd573c7bff0 (diff) | |
download | wireshark-5603cef9f2755f0826933e78f4e511bdc47d16b2.tar.gz wireshark-5603cef9f2755f0826933e78f4e511bdc47d16b2.tar.bz2 wireshark-5603cef9f2755f0826933e78f4e511bdc47d16b2.zip |
Remove support for libpcre, we use GRegex in GLib.
svn path=/trunk/; revision=38683
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | CMakeOptions.txt | 1 | ||||
-rw-r--r-- | Makefile.am | 5 | ||||
-rw-r--r-- | acinclude.m4 | 106 | ||||
-rw-r--r-- | cmake/modules/FindPCRE.cmake | 35 | ||||
-rw-r--r-- | cmakeconfig.h.in | 3 | ||||
-rw-r--r-- | configure.in | 41 | ||||
-rw-r--r-- | debian/control | 2 | ||||
-rw-r--r-- | doc/README.developer | 12 | ||||
-rw-r--r-- | docbook/wsdg_src/WSDG_chapter_libraries.xml | 32 | ||||
-rw-r--r-- | epan/CMakeLists.txt | 1 | ||||
-rw-r--r-- | epan/Makefile.nmake | 3 | ||||
-rw-r--r-- | epan/dfilter/Makefile.nmake | 2 | ||||
-rw-r--r-- | epan/dissectors/Makefile.nmake | 2 | ||||
-rw-r--r-- | epan/epan.c | 17 | ||||
-rw-r--r-- | epan/ftypes/Makefile.am | 2 | ||||
-rw-r--r-- | epan/ftypes/Makefile.nmake | 2 | ||||
-rw-r--r-- | epan/ftypes/ftype-bytes.c | 40 | ||||
-rw-r--r-- | epan/ftypes/ftype-pcre.c | 192 | ||||
-rw-r--r-- | epan/ftypes/ftype-string.c | 39 | ||||
-rw-r--r-- | epan/ftypes/ftype-tvbuff.c | 51 | ||||
-rw-r--r-- | epan/ftypes/ftypes-int.h | 13 | ||||
-rw-r--r-- | epan/ftypes/ftypes.h | 8 | ||||
-rw-r--r-- | version_info.c | 4 |
24 files changed, 10 insertions, 609 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index dfcd6c3715..10719b083a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -271,11 +271,6 @@ if(ENABLE_GNUTLS) set(PACKAGELIST ${PACKAGELIST} GNUTLS) endif() -# Regular expressions lib -if(ENABLE_PCRE) - set(PACKAGELIST ${PACKAGELIST} PCRE) -endif() - # Kerberos if(ENABLE_KERBEROS) set(PACKAGELIST ${PACKAGELIST} KERBEROS) @@ -650,7 +645,6 @@ set(LIBEPAN_LIBS # @SSL_LIBS@ # -lcrypto epan # $(plugin_ldadd) # in case of static - ${PCRE_LIBRARIES} ${PCAP_LIBRARIES} ${CARES_LIBRARIES} ${ADNS_LIBRARIES} diff --git a/CMakeOptions.txt b/CMakeOptions.txt index be47cbd9c7..57e915d400 100644 --- a/CMakeOptions.txt +++ b/CMakeOptions.txt @@ -34,7 +34,6 @@ option(ENABLE_PCAP_NG_DEFAULT "Enable pcap-ng as default file format" ON) option(ENABLE_THREADS "Build with threads support" ON) option(ENABLE_ADNS "Build with adns support" ON) -option(ENABLE_PCRE "Build with pcre support" OFF) option(ENABLE_PORTAUDIO "Build with portaudio support" ON) option(ENABLE_ZLIB "Build with zlib compression support" ON) option(ENABLE_LUA "Build with lua dissector support" ON) diff --git a/Makefile.am b/Makefile.am index e39efa9017..b565ac8e00 100644 --- a/Makefile.am +++ b/Makefile.am @@ -329,7 +329,6 @@ wireshark_LDADD = \ wsutil/libwsutil.la \ @SSL_LIBS@ \ $(plugin_ldadd) \ - @PCRE_LIBS@ \ @PCAP_LIBS@ \ @GTK_LIBS@ -lm \ @C_ARES_LIBS@ \ @@ -357,7 +356,6 @@ tshark_LDADD = \ wsutil/libwsutil.la \ @SSL_LIBS@ \ $(plugin_ldadd) \ - @PCRE_LIBS@ \ @GLIB_LIBS@ -lm \ @PCAP_LIBS@ \ @SOCKET_LIBS@ \ @@ -385,7 +383,6 @@ rawshark_LDADD = \ wsutil/libwsutil.la \ @SSL_LIBS@ \ $(plugin_ldadd) \ - @PCRE_LIBS@ \ @GLIB_LIBS@ -lm \ @PCAP_LIBS@ \ @SOCKET_LIBS@ \ @@ -452,7 +449,6 @@ dftest_LDADD = \ epan/libwireshark.la \ @SSL_LIBS@ \ $(plugin_ldadd) \ - @PCRE_LIBS@ \ @GLIB_LIBS@ -lm \ @PCAP_LIBS@ \ @SOCKET_LIBS@ \ @@ -846,7 +842,6 @@ EXTRA_DIST = \ cmake/modules/FindLYNX.cmake \ cmake/modules/FindM.cmake \ cmake/modules/FindPCAP.cmake \ - cmake/modules/FindPCRE.cmake \ cmake/modules/FindPOD.cmake \ cmake/modules/FindPORTAUDIO.cmake \ cmake/modules/FindPYTHON.cmake \ diff --git a/acinclude.m4 b/acinclude.m4 index 5898b14f1a..9309a523c1 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -765,112 +765,6 @@ AC_DEFUN([AC_WIRESHARK_ZLIB_CHECK], ]) # -# AC_WIRESHARK_LIBPCRE_CHECK -# -AC_DEFUN([AC_WIRESHARK_LIBPCRE_CHECK], -[ - if test "x$pcre_dir" != "x" - then - # - # The user specified a directory in which libpcre resides, - # so add the "include" subdirectory of that directory to - # the include file search path and the "lib" subdirectory - # of that directory to the library search path. - # - # XXX - if there's also a libpcre in a directory that's - # already in CFLAGS, CPPFLAGS, or LDFLAGS, this won't - # make us find the version in the specified directory, - # as the compiler and/or linker will search that other - # directory before it searches the specified directory. - # - wireshark_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -I$pcre_dir/include" - wireshark_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -I$pcre_dir/include" - wireshark_save_LIBS="$LIBS" - LIBS="$LIBS -lpcre" - wireshark_save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -L$pcre_dir/lib" - fi - - # - # Make sure we have "pcre.h". If we don't, it means we probably - # don't have libpcre, so don't use it. - # - AC_CHECK_HEADER(pcre.h,, - [ - if test "x$pcre_dir" != "x" - then - # - # The user used "--with-pcre=" to specify a directory - # containing libpcre, but we didn't find the header file - # there; that either means they didn't specify the - # right directory or are confused about whether libpcre - # is, in fact, installed. Report the error and give up. - # - AC_MSG_ERROR([libpcre header not found in directory specified in --with-pcre]) - else - if test "x$want_pcre" = "xyes" - then - # - # The user tried to force us to use the library, but we - # couldn't find the header file; report an error. - # - AC_MSG_ERROR(Header file pcre.h not found.) - else - # - # We couldn't find the header file; don't use the - # library, as it's probably not present. - # - want_pcre=no - fi - fi - ]) - - if test "x$want_pcre" != "xno" - then - # - # Well, we at least have the pcre header file. - # - # We're only using standard functions from libpcre, - # so we don't need to perform extra checks. - # - AC_CHECK_LIB(pcre, pcre_compile, - [ - if test "x$pcre_dir" != "x" - then - # - # Put the "-I" and "-L" flags for pcre at - # the beginning of CFLAGS, CPPFLAGS, - # LDFLAGS, and LIBS. - # - PCRE_LIBS="-L$pcre_dir/lib -lpcre $wireshark_save_LIBS" - else - PCRE_LIBS="-lpcre" - fi - AC_DEFINE(HAVE_LIBPCRE, 1, [Define to use libpcre library]) - ],[ - if test "x$pcre_dir" != "x" - then - # - # Restore the versions of CFLAGS, CPPFLAGS, - # LDFLAGS, and LIBS before we added the - # "--with-pcre=" directory, as we didn't - # actually find pcre there. - # - CFLAGS="$wireshark_save_CFLAGS" - CPPFLAGS="$wireshark_save_CPPFLAGS" - LDFLAGS="$wireshark_save_LDFLAGS" - LIBS="$wireshark_save_LIBS" - PCRE_LIBS="" - fi - want_pcre=no - ]) - AC_SUBST(PCRE_LIBS) - fi -]) - -# # AC_WIRESHARK_LIBLUA_CHECK # AC_DEFUN([AC_WIRESHARK_LIBLUA_CHECK],[ diff --git a/cmake/modules/FindPCRE.cmake b/cmake/modules/FindPCRE.cmake deleted file mode 100644 index 125235609e..0000000000 --- a/cmake/modules/FindPCRE.cmake +++ /dev/null @@ -1,35 +0,0 @@ -# -# $Id$ -# -# - Find pcre -# Find the native PCRE includes and library -# -# PCRE_INCLUDE_DIRS - where to find pcre.h, etc. -# PCRE_LIBRARIES - List of libraries when using pcre. -# PCRE_FOUND - True if pcre found. - - -IF (PCRE_INCLUDE_DIRS) - # Already in cache, be silent - SET(PCRE_FIND_QUIETLY TRUE) -ENDIF (PCRE_INCLUDE_DIRS) - -FIND_PATH(PCRE_INCLUDE_DIR pcre.h) - -SET(PCRE_NAMES pcre) -FIND_LIBRARY(PCRE_LIBRARY NAMES ${PCRE_NAMES} ) - -# handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE DEFAULT_MSG PCRE_LIBRARY PCRE_INCLUDE_DIR) - -IF(PCRE_FOUND) - SET( PCRE_LIBRARIES ${PCRE_LIBRARY} ) - SET( PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR} ) -ELSE(PCRE_FOUND) - SET( PCRE_LIBRARIES ) - SET( PCRE_INCLUDE_DIRS ) -ENDIF(PCRE_FOUND) - -MARK_AS_ADVANCED( PCRE_LIBRARIES PCRE_INCLUDE_DIRS ) diff --git a/cmakeconfig.h.in b/cmakeconfig.h.in index 6a93dc2888..6c6e571511 100644 --- a/cmakeconfig.h.in +++ b/cmakeconfig.h.in @@ -108,9 +108,6 @@ /* Define to use libpcap library */ #cmakedefine HAVE_LIBPCAP 1 -/* Define to use libpcre library */ -#cmakedefine HAVE_LIBPCRE 1 - /* Define to use dbus-glib library */ #cmakedefine HAVE_LIBDBUS 1 diff --git a/configure.in b/configure.in index 804538fbd2..5070689e62 100644 --- a/configure.in +++ b/configure.in @@ -663,7 +663,7 @@ if test "x$ac_cv_enable_usr_local" = "xyes" ; then # # Arrange that we search for header files in the source directory # and in its "wiretap" subdirectory, as well as in "/usr/local/include", - # as various packages we use ("libpcap", "zlib", "adns", "pcre") + # as various packages we use ("libpcap", "zlib", "adns") # may have been installed under "/usr/local/include". # CFLAGS="$CFLAGS -I/usr/local/include" @@ -1317,38 +1317,6 @@ else fi fi -dnl pcre check -AC_MSG_CHECKING(whether to use libpcre for regular expressions in dfilters) - -AC_ARG_WITH(pcre, - AC_HELP_STRING( [--with-pcre@<:@=DIR@:>@], - [use libpcre (located in directory DIR, if supplied) to use in dfilter regular expressions. Not needed if you have GLib 2.14 or later @<:@default=no@:>@]), -[ - if test $withval = no - then - want_pcre=no - elif test $withval = yes - then - want_pcre=yes - else - want_pcre=yes - pcre_dir=$withval - fi -],[ - want_pcre=no - pcre_dir= -]) -if test "x$want_pcre" = "xno" ; then - AC_MSG_RESULT(no) -else - AC_MSG_RESULT(yes) - AC_WIRESHARK_LIBPCRE_CHECK - if test "x$want_pcre" = "xno" ; then - AC_MSG_RESULT(libpcre not found) - fi -fi - - dnl Lua check AC_MSG_CHECKING(whether to use liblua for the Lua scripting plugin) @@ -2096,12 +2064,6 @@ else zlib_message="yes" fi -if test "x$want_pcre" = "xno" ; then - pcre_message="no (using GRegex instead)" -else - pcre_message="yes" -fi - if test "x$want_lua" = "xyes" ; then lua_message="yes" else @@ -2186,7 +2148,6 @@ echo " Use threads : $enable_threads" echo " Build profile binaries : $enable_profile_build" echo " Use pcap library : $want_pcap" echo " Use zlib library : $zlib_message" -echo " Use pcre library : $pcre_message" echo " Use kerberos library : $krb5_message" echo " Use c-ares library : $c_ares_message" echo " Use GNU ADNS library : $adns_message" diff --git a/debian/control b/debian/control index 160bbcfebe..d6192610fe 100644 --- a/debian/control +++ b/debian/control @@ -6,7 +6,7 @@ X-Orig-Maintainer: Frederic Peters <fpeters@debian.org> X-Orig-Uploaders: Joost Yervante Damad <andete@debian.org> Standards-Version: 3.8.1.0 Homepage: http://www.wireshark.org -Build-Depends: libgtk2.0-dev (>=2.4.0-0), libpcap0.8-dev, flex, libz-dev, dpatch, debhelper (>= 6), libtool, python, automake1.9, autoconf, autotools-dev, libc-ares-dev, xsltproc, docbook-xsl (>= 1.64.1.0-0), libpcre3-dev, libcap-dev [!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386], bison, libgnutls-dev, python-support (>= 0.3), portaudio19-dev, libkrb5-dev, liblua5.1-0-dev, libsmi2-dev, libgeoip-dev +Build-Depends: libgtk2.0-dev (>=2.4.0-0), libpcap0.8-dev, flex, libz-dev, dpatch, debhelper (>= 6), libtool, python, automake1.9, autoconf, autotools-dev, libc-ares-dev, xsltproc, docbook-xsl (>= 1.64.1.0-0), libcap-dev [!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386], bison, libgnutls-dev, python-support (>= 0.3), portaudio19-dev, libkrb5-dev, liblua5.1-0-dev, libsmi2-dev, libgeoip-dev Build-Conflicts: libsnmp4.2-dev, libsnmp-dev XS-Python-Version: all diff --git a/doc/README.developer b/doc/README.developer index 4a3041cef6..838d67428d 100644 --- a/doc/README.developer +++ b/doc/README.developer @@ -746,17 +746,7 @@ protocol, followed by ".h"; any dissector file that calls your dissector should be changed to include that file. You may not need to include all the headers listed in the skeleton -below, and you may need to include additional headers. For example, the -code inside - - #ifdef HAVE_LIBPCRE - - ... - - #endif - -is needed only if you are using a function from libpcre, e.g. the -"pcre_compile()" function. +below, and you may need to include additional headers. The stdio.h, stdlib.h and string.h header files should be included only as needed. diff --git a/docbook/wsdg_src/WSDG_chapter_libraries.xml b/docbook/wsdg_src/WSDG_chapter_libraries.xml index c8cb11810b..ab2cdac9e0 100644 --- a/docbook/wsdg_src/WSDG_chapter_libraries.xml +++ b/docbook/wsdg_src/WSDG_chapter_libraries.xml @@ -305,38 +305,6 @@ utilities." </section> - <section id="ChLibsPCRE"> - <title>PCRE (optional)</title> - <para> - "Perl compatible regular expressions". PCRE provides the pattern matching - functionality required for the "matches" display filter operator. - </para> - <para> - You probably don't need this. GRegex, part of GLib 2.14 and later is a - wrapper around PCRE. Wireshark's configure script will use it instead of - PCRE if it is present. - </para> - - <section id="ChLibsUnixPCRE"> - <title>Unix</title> - <para> - If this library isn't already installed or available as a - package for your platform, you can get it at: - <ulink url="http://www.pcre.org/"/>. - </para> - </section> - - <section id="ChLibsWin32PCRE"> - <title>Win32 MSVC</title> - <para> - You can get the latest version at: - <ulink url="http://gnuwin32.sourceforge.net/packages/pcre.htm"/> - </para> - </section> - - </section> - - <section id="ChLibsZlib"> <title>zlib (optional)</title> <para> diff --git a/epan/CMakeLists.txt b/epan/CMakeLists.txt index 71764a667e..04fa50bd00 100644 --- a/epan/CMakeLists.txt +++ b/epan/CMakeLists.txt @@ -1288,7 +1288,6 @@ set(epan_LIBS wiretap wsutil # @SSL_LIBS@ - ${PCRE_LIBRARIES} ${GLIB2_LIBRARIES} ${PCAP_LIBRARIES} # @SOCKET_LIBS@ diff --git a/epan/Makefile.nmake b/epan/Makefile.nmake index 35b631d5a8..4efc7924cc 100644 --- a/epan/Makefile.nmake +++ b/epan/Makefile.nmake @@ -15,7 +15,7 @@ LINK= link GENERATED_CFLAGS=\ $(STANDARD_CFLAGS) \ /I. /I.. /I../wiretap $(GLIB_CFLAGS) \ - $(ZLIB_CFLAGS) $(C_ARES_CFLAGS) $(ADNS_CFLAGS) $(PCRE_CFLAGS) \ + $(ZLIB_CFLAGS) $(C_ARES_CFLAGS) $(ADNS_CFLAGS) \ $(LUA_CFLAGS) $(GNUTLS_CFLAGS) /I$(PCAP_DIR)\include \ $(PYTHON_CFLAGS) $(SMI_CFLAGS) $(GEOIP_CFLAGS) @@ -42,7 +42,6 @@ libwireshark_LIBS = \ $(GLIB_LIBS) \ $(C_ARES_LIBS) \ $(ADNS_LIBS) \ - $(PCRE_LIBS) \ $(KFW_LIBS) \ $(NETTLE_LIBS) \ $(ZLIB_LIBS) \ diff --git a/epan/dfilter/Makefile.nmake b/epan/dfilter/Makefile.nmake index 388855205b..b0a5847b89 100644 --- a/epan/dfilter/Makefile.nmake +++ b/epan/dfilter/Makefile.nmake @@ -15,7 +15,7 @@ GENERATED_CFLAGS=\ $(STANDARD_CFLAGS) \ /I. /I.. /I..\.. $(GLIB_CFLAGS) \ /I$(LEMON) \ - $(PCRE_CFLAGS) /I$(PCAP_DIR)\include + /I$(PCAP_DIR)\include CFLAGS=$(WARNINGS_ARE_ERRORS) $(GENERATED_CFLAGS) diff --git a/epan/dissectors/Makefile.nmake b/epan/dissectors/Makefile.nmake index 721dee92b4..ee966ca9de 100644 --- a/epan/dissectors/Makefile.nmake +++ b/epan/dissectors/Makefile.nmake @@ -14,7 +14,7 @@ include Makefile.common CFLAGS= $(WARNINGS_ARE_ERRORS) $(STANDARD_CFLAGS) \ /I. /I.. /I../.. $(GLIB_CFLAGS) \ $(ZLIB_CFLAGS) \ - $(PCRE_CFLAGS) $(GNUTLS_CFLAGS) $(NETTLE_CFLAGS) \ + $(GNUTLS_CFLAGS) $(NETTLE_CFLAGS) \ $(KFW_CFLAGS) $(AIRPCAP_CFLAGS) $(GEOIP_CFLAGS) \ /I$(PCAP_DIR)\include diff --git a/epan/epan.c b/epan/epan.c index fb1c6494e0..f055c2dd7f 100644 --- a/epan/epan.c +++ b/epan/epan.c @@ -256,23 +256,6 @@ epan_dissect_fill_in_columns(epan_dissect_t *edt, const gboolean fill_col_exprs, void epan_get_compiled_version_info(GString *str) { - /* PCRE */ - g_string_append(str, ", "); -#ifdef HAVE_LIBPCRE - g_string_append(str, "with libpcre "); -#ifdef PCRE_MAJOR -#ifdef PCRE_MINOR - g_string_append_printf(str, "%u.%u", PCRE_MAJOR, PCRE_MINOR); -#else /* PCRE_MINOR */ - g_string_append_printf(str, "%u", PCRE_MAJOR); -#endif /* PCRE_MINOR */ -#else /* PCRE_MAJOR */ - g_string_append(str, "(version unknown)"); -#endif /* PCRE_MAJOR */ -#else /* HAVE_LIBPCRE */ - g_string_append(str, "without libpcre"); -#endif /* HAVE_LIBPCRE */ - /* SNMP */ g_string_append(str, ", "); #ifdef HAVE_LIBSMI diff --git a/epan/ftypes/Makefile.am b/epan/ftypes/Makefile.am index 67f39d22c6..ffb0cf4b7a 100644 --- a/epan/ftypes/Makefile.am +++ b/epan/ftypes/Makefile.am @@ -40,7 +40,7 @@ INCLUDES = -I$(srcdir)/../.. -I$(srcdir)/.. libftypes_la_SOURCES = $(NONGENERATED_C_FILES) $(NONGENERATED_HEADER_FILES) -libftypes_la_LIBADD = @GLIB_LIBS@ @PCRE_LIBS@ +libftypes_la_LIBADD = @GLIB_LIBS@ EXTRA_DIST = \ Makefile.common \ diff --git a/epan/ftypes/Makefile.nmake b/epan/ftypes/Makefile.nmake index f980bf273a..11c983743d 100644 --- a/epan/ftypes/Makefile.nmake +++ b/epan/ftypes/Makefile.nmake @@ -11,7 +11,7 @@ include Makefile.common CFLAGS=$(WARNINGS_ARE_ERRORS) $(STANDARD_CFLAGS) \ /I. /I.. /I../.. $(GLIB_CFLAGS) \ - $(PCRE_CFLAGS) /I$(PCAP_DIR)\include + /I$(PCAP_DIR)\include .c.obj:: $(CC) $(CVARSDLL) $(CFLAGS) -Fd.\ -c $< diff --git a/epan/ftypes/ftype-bytes.c b/epan/ftypes/ftype-bytes.c index 95094810cd..2b67f3d0be 100644 --- a/epan/ftypes/ftype-bytes.c +++ b/epan/ftypes/ftype-bytes.c @@ -32,9 +32,6 @@ #include <epan/strutil.h> #include <epan/oids.h> -#ifdef HAVE_LIBPCRE -# include <pcre.h> -#endif #define CMP_MATCHES cmp_matches static void @@ -467,42 +464,6 @@ cmp_contains(fvalue_t *fv_a, fvalue_t *fv_b) } } -#ifdef HAVE_LIBPCRE -static gboolean -cmp_matches(fvalue_t *fv_a, fvalue_t *fv_b) -{ - GByteArray *a = fv_a->value.bytes; - pcre_tuple_t *pcre_t = fv_b->value.re; - int options = 0; - int rc; - - /* fv_b is always a FT_PCRE, otherwise the dfilter semcheck() would have - * warned us. For the same reason (and because we're using g_malloc()), - * fv_b->value.re is not NULL. - */ - if (strcmp(fv_b->ftype->name, "FT_PCRE") != 0) { - return FALSE; - } - if (! pcre_t) { - return FALSE; - } - rc = pcre_exec( - pcre_t->re, /* Compiled PCRE */ - pcre_t->ex, /* PCRE extra from pcre_study() */ - a->data, /* The data to check for the pattern... */ - (int)a->len, /* ... and its length */ - 0, /* Start offset within data */ - options, /* PCRE options */ - NULL, /* We are not interested in the matched string */ - 0 /* of the pattern; only in success or failure. */ - ); - /* NOTE - DO NOT g_free(data) */ - if (rc == 0) { - return TRUE; - } - return FALSE; -} -#else /* GRegex */ static gboolean cmp_matches(fvalue_t *fv_a, fvalue_t *fv_b) { @@ -530,7 +491,6 @@ cmp_matches(fvalue_t *fv_a, fvalue_t *fv_b) ); /* NOTE - DO NOT g_free(data) */ } -#endif /* HAVE_LIBPCRE / GRegex */ void ftype_register_bytes(void) diff --git a/epan/ftypes/ftype-pcre.c b/epan/ftypes/ftype-pcre.c index c94f541d26..b330c4b021 100644 --- a/epan/ftypes/ftype-pcre.c +++ b/epan/ftypes/ftype-pcre.c @@ -23,8 +23,6 @@ /* Perl-Compatible Regular Expression (PCRE) internal field type. * Used with the "matches" dfilter operator, allowing efficient * compilation and studying of a PCRE pattern in dfilters. - * - * PCRE is provided with libpcre (http://www.pcre.org/). */ #ifdef HAVE_CONFIG_H @@ -33,192 +31,6 @@ #include <ftypes-int.h> -#ifdef HAVE_LIBPCRE - -#include <string.h> - -#include <pcre.h> - -/* Create a pcre_tuple_t object based on the given string pattern */ -static pcre_tuple_t * -pcre_tuple_new(const char *value) -{ - pcre_tuple_t *tuple; - const char *pcre_error_text; - int pcre_error_offset; - - tuple = g_malloc(sizeof(pcre_tuple_t)); - tuple->string = g_strdup(value); /* The RE as string */ - tuple->ex = NULL; - /* Compile the RE */ - tuple->re = pcre_compile( - value, /* pattern */ - 0, /* PCRE options */ - &pcre_error_text, /* PCRE constant error string */ - &pcre_error_offset, /* Start offset of error in pattern */ - NULL /* Default char tables (C locale) */ - ); - if (pcre_error_text) { - tuple->error = g_strdup_printf("In regular expression \"%s\":\n" - "%s (character position %d)", - value, pcre_error_text, pcre_error_offset); - return tuple; - } else { - tuple->error = NULL; - } - /* Study the RE */ - tuple->ex = pcre_study(tuple->re, 0, &pcre_error_text); - if (pcre_error_text) { - if (tuple->error) { - tuple->error = g_strdup_printf("In regular expression \"%s\":\n" - "%s. %s", - value, tuple->error, pcre_error_text); - } else { - tuple->error = g_strdup_printf("In regular expression \"%s\":\n" - "%s", - value, pcre_error_text); - } - } - return tuple; -} - -static void -pcre_tuple_free(pcre_tuple_t *tuple) -{ - if (tuple) { - g_free(tuple->string); - g_free(tuple->re); - g_free(tuple->ex); - g_free(tuple->error); - g_free(tuple); - } -} - -static void -pcre_fvalue_new(fvalue_t *fv) -{ - fv->value.re = NULL; -} - -static void -pcre_fvalue_free(fvalue_t *fv) -{ - if (fv->value.re) { - pcre_tuple_free(fv->value.re); - } -} - -/* Generate a FT_PCRE from a parsed string pattern. - * Uses the specified logfunc() to report errors. */ -static gboolean -val_from_string(fvalue_t *fv, char *pattern, LogFunc logfunc) -{ - /* Free up the old value, if we have one */ - pcre_fvalue_free(fv); - - fv->value.re = pcre_tuple_new(pattern); - if (fv->value.re->error) { - logfunc(fv->value.re->error); - return FALSE; - } - return TRUE; -} - -/* Generate a FT_PCRE from an unparsed string pattern. - * Uses the specified logfunc() to report errors. */ -static gboolean -val_from_unparsed(fvalue_t *fv, char *pattern, gboolean allow_partial_value _U_, LogFunc logfunc) -{ - /* Free up the old value, if we have one */ - pcre_fvalue_free(fv); - g_assert(! allow_partial_value); - - fv->value.re = pcre_tuple_new(pattern); - if (fv->value.re->error) { - logfunc(fv->value.re->error); - return FALSE; - } - return TRUE; -} - -static int -pcre_repr_len(fvalue_t *fv, ftrepr_t rtype) -{ - g_assert(rtype == FTREPR_DFILTER); - return (int)strlen(fv->value.re->string); -} - -static void -pcre_to_repr(fvalue_t *fv, ftrepr_t rtype, char *buf) -{ - g_assert(rtype == FTREPR_DFILTER); - strcpy(buf, fv->value.re->string); -} - -/* BEHOLD - value contains the string representation of the regular expression, - * and we want to store the compiled PCRE RE object into the value. */ -static void -pcre_fvalue_set(fvalue_t *fv, gpointer value, gboolean already_copied) -{ - g_assert(value != NULL); - /* Free up the old value, if we have one */ - pcre_fvalue_free(fv); - g_assert(! already_copied); - fv->value.re = pcre_tuple_new(value); -} - -static gpointer -pcre_fvalue_get(fvalue_t *fv) -{ - return fv->value.re; -} - -void -ftype_register_pcre(void) -{ - static ftype_t pcre_type = { - FT_PCRE, /* ftype */ - "FT_PCRE", /* name */ - "Compiled Perl-Compatible Regular Expression object", /* pretty_name */ - 0, /* wire_size */ - pcre_fvalue_new, /* new_value */ - pcre_fvalue_free, /* free_value */ - val_from_unparsed, /* val_from_unparsed */ - val_from_string, /* val_from_string */ - pcre_to_repr, /* val_to_string_repr */ - pcre_repr_len, /* len_string_repr */ - - pcre_fvalue_set, /* set_value */ - NULL, /* set_value_uinteger */ - NULL, /* set_value_sinteger */ - NULL, /* set_value_integer64 */ - NULL, /* set_value_floating */ - - pcre_fvalue_get, /* get_value */ - NULL, /* get_value_uinteger */ - NULL, /* get_value_sinteger */ - NULL, /* get_value_integer64 */ - NULL, /* get_value_floating */ - - NULL, /* cmp_eq */ - NULL, /* cmp_ne */ - NULL, /* cmp_gt */ - NULL, /* cmp_ge */ - NULL, /* cmp_lt */ - NULL, /* cmp_le */ - NULL, /* cmp_bitwise_and */ - NULL, /* cmp_contains */ - NULL, /* cmp_matches */ - - NULL, /* len */ - NULL, /* slice */ - }; - ftype_register(FT_PCRE, &pcre_type); -} - -#else /* No HAVE_LIBPCRE. Try falling back to GRegex. */ - - #include <glib.h> #include <string.h> @@ -248,7 +60,7 @@ val_from_string(fvalue_t *fv, char *pattern, LogFunc logfunc) fv->value.re = g_regex_new( pattern, /* pattern */ - G_REGEX_OPTIMIZE, /* Compile options (G_REGEX_OPTIMIZE = pcre_study) */ + G_REGEX_OPTIMIZE, /* Compile options */ 0, /* Match options */ ®ex_error /* Compile / study errors */ ); @@ -351,8 +163,6 @@ ftype_register_pcre(void) ftype_register(FT_PCRE, &pcre_type); } -#endif /* HAVE_LIBPCRE */ - /* * Editor modelines - http://www.wireshark.org/tools/modelines.html * diff --git a/epan/ftypes/ftype-string.c b/epan/ftypes/ftype-string.c index 24ec502d9d..3b9aaf30af 100644 --- a/epan/ftypes/ftype-string.c +++ b/epan/ftypes/ftype-string.c @@ -28,9 +28,6 @@ #include <ftypes-int.h> #include <string.h> -#ifdef HAVE_LIBPCRE -# include <pcre.h> -#endif #define CMP_MATCHES cmp_matches #include <ctype.h> @@ -250,41 +247,6 @@ cmp_contains(fvalue_t *fv_a, fvalue_t *fv_b) } } -#ifdef HAVE_LIBPCRE -static gboolean -cmp_matches(fvalue_t *fv_a, fvalue_t *fv_b) -{ - char *str = fv_a->value.string; - pcre_tuple_t *pcre_t = fv_b->value.re; - int options = 0; - int rc; - - /* fv_b is always a FT_PCRE, otherwise the dfilter semcheck() would have - * warned us. For the same reason (and because we're using g_malloc()), - * fv_b->value.re is not NULL. - */ - if (strcmp(fv_b->ftype->name, "FT_PCRE") != 0) { - return FALSE; - } - if (! pcre_t) { - return FALSE; - } - rc = pcre_exec( - pcre_t->re, /* Compiled PCRE */ - pcre_t->ex, /* PCRE extra from pcre_study() */ - str, /* The data to check for the pattern... */ - (int)strlen(str), /* ... and its length */ - 0, /* Start offset within data */ - options, /* PCRE options */ - NULL, /* We are not interested in the matched string */ - 0 /* of the pattern; only in success or failure. */ - ); - if (rc == 0) { - return TRUE; - } - return FALSE; -} -#else /* GRegex */ static gboolean cmp_matches(fvalue_t *fv_a, fvalue_t *fv_b) { @@ -311,7 +273,6 @@ cmp_matches(fvalue_t *fv_a, fvalue_t *fv_b) NULL /* We don't want error information */ ); } -#endif /* HAVE_LIBPCRE / GRegex */ void ftype_register_string(void) diff --git a/epan/ftypes/ftype-tvbuff.c b/epan/ftypes/ftype-tvbuff.c index f87c88eed5..4e6cc970b2 100644 --- a/epan/ftypes/ftype-tvbuff.c +++ b/epan/ftypes/ftype-tvbuff.c @@ -28,9 +28,6 @@ #include <ftypes-int.h> #include <string.h> -#ifdef HAVE_LIBPCRE -# include <pcre.h> -#endif #define CMP_MATCHES cmp_matches #define tvb_is_private fvalue_gboolean1 @@ -395,52 +392,6 @@ cmp_contains(fvalue_t *fv_a, fvalue_t *fv_b) return FALSE; } -#ifdef HAVE_LIBPCRE -static gboolean -cmp_matches(fvalue_t *fv_a, fvalue_t *fv_b) -{ - tvbuff_t *tvb = fv_a->value.tvb; - pcre_tuple_t *pcre_t = fv_b->value.re; - int options = 0; - volatile int rc = 1; - const char *data = NULL; /* tvb data */ - guint32 tvb_len; /* tvb length */ - - /* fv_b is always a FT_PCRE, otherwise the dfilter semcheck() would have - * warned us. For the same reason (and because we're using g_malloc()), - * fv_b->value.re is not NULL. - */ - if (strcmp(fv_b->ftype->name, "FT_PCRE") != 0) { - return FALSE; - } - if (! pcre_t) { - return FALSE; - } - TRY { - tvb_len = tvb_length(tvb); - data = (const char *)tvb_get_ptr(tvb, 0, tvb_len); - rc = pcre_exec( - pcre_t->re, /* Compiled PCRE */ - pcre_t->ex, /* PCRE extra from pcre_study() */ - data, /* The data to check for the pattern... */ - tvb_len, /* ... and its length */ - 0, /* Start offset within data */ - options, /* PCRE options */ - NULL, /* We are not interested in the matched string */ - 0 /* of the pattern; only in success or failure. */ - ); - /* NOTE - DO NOT g_free(data) */ - } - CATCH_ALL { - return FALSE; - } - ENDTRY; - if (rc == 0) { - return TRUE; - } - return FALSE; -} -#else /* GRegex */ static gboolean cmp_matches(fvalue_t *fv_a, fvalue_t *fv_b) { @@ -480,7 +431,7 @@ cmp_matches(fvalue_t *fv_a, fvalue_t *fv_b) ENDTRY; return rc; } -#endif /* HAVE_LIBPCRE / GRegex */ + void ftype_register_tvbuff(void) { diff --git a/epan/ftypes/ftypes-int.h b/epan/ftypes/ftypes-int.h index 0e8154e400..23349c48ec 100644 --- a/epan/ftypes/ftypes-int.h +++ b/epan/ftypes/ftypes-int.h @@ -26,19 +26,6 @@ #include <epan/packet.h> #include "ftypes.h" -#ifdef HAVE_LIBPCRE -#include <pcre.h> -#endif /* HAVE_LIBPCRE */ - - -#ifdef HAVE_LIBPCRE -struct _pcre_tuple_t { - char *string; - pcre *re; - pcre_extra *ex; - char *error; -}; -#endif /* HAVE_LIBPCRE */ void ftype_register(enum ftenum ftype, ftype_t *ft); diff --git a/epan/ftypes/ftypes.h b/epan/ftypes/ftypes.h index dd95df2720..a3a22b8741 100644 --- a/epan/ftypes/ftypes.h +++ b/epan/ftypes/ftypes.h @@ -90,10 +90,6 @@ enum ftrepr { typedef enum ftrepr ftrepr_t; -#ifdef HAVE_LIBPCRE -typedef struct _pcre_tuple_t pcre_tuple_t; -#endif /* HAVE_LIBPCRE */ - /* Initialize the ftypes subsytem. Called once. */ void ftypes_initialize(void); @@ -168,11 +164,7 @@ typedef struct _fvalue_t { e_guid_t guid; nstime_t time; tvbuff_t *tvb; -#ifdef HAVE_LIBPCRE - pcre_tuple_t *re; -#else /* Try falling back to GRegex. */ GRegex *re; -#endif /* HAVE_LIBPCRE */ } value; /* The following is provided for private use diff --git a/version_info.c b/version_info.c index f4c880f3d8..7a4f62b018 100644 --- a/version_info.c +++ b/version_info.c @@ -37,10 +37,6 @@ #include <zlib.h> /* to get the libz version number */ #endif -#ifdef HAVE_LIBPCRE -#include <pcre.h> /* to get the libpcre version number */ -#endif /* HAVE_LIBPCRE */ - #ifdef HAVE_SYS_UTSNAME_H #include <sys/utsname.h> #endif |