Remove support for libpcre, we use GRegex in GLib.
authorStig Bjørlykke <stig@bjorlykke.org>
Tue, 23 Aug 2011 09:25:06 +0000 (09:25 -0000)
committerStig Bjørlykke <stig@bjorlykke.org>
Tue, 23 Aug 2011 09:25:06 +0000 (09:25 -0000)
svn path=/trunk/; revision=38683

24 files changed:
CMakeLists.txt
CMakeOptions.txt
Makefile.am
acinclude.m4
cmake/modules/FindPCRE.cmake [deleted file]
cmakeconfig.h.in
configure.in
debian/control
doc/README.developer
docbook/wsdg_src/WSDG_chapter_libraries.xml
epan/CMakeLists.txt
epan/Makefile.nmake
epan/dfilter/Makefile.nmake
epan/dissectors/Makefile.nmake
epan/epan.c
epan/ftypes/Makefile.am
epan/ftypes/Makefile.nmake
epan/ftypes/ftype-bytes.c
epan/ftypes/ftype-pcre.c
epan/ftypes/ftype-string.c
epan/ftypes/ftype-tvbuff.c
epan/ftypes/ftypes-int.h
epan/ftypes/ftypes.h
version_info.c

index dfcd6c3715c82a75ba060f2e67cdcc7bd928e640..10719b083a104042d831a7f1a384c214c07d240f 100644 (file)
@@ -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}
index be47cbd9c790f2faa6bda4308fd9778df2f25543..57e915d4007e9721f5d7ed1c4c5fc070eceb6524 100644 (file)
@@ -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)
index e39efa9017b60a24adca9742770df50cc0452f15..b565ac8e0062e467a0d66d8dc316a86b62406531 100644 (file)
@@ -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          \
index 5898b14f1a8218356b93491adf34df42f7c4f21a..9309a523c1b490326c7b73e45ea9353d338baac2 100644 (file)
@@ -764,112 +764,6 @@ AC_DEFUN([AC_WIRESHARK_ZLIB_CHECK],
        fi
 ])
 
-#
-# 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
 #
diff --git a/cmake/modules/FindPCRE.cmake b/cmake/modules/FindPCRE.cmake
deleted file mode 100644 (file)
index 1252356..0000000
+++ /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 )
index 6a93dc2888e907459c65eeb56035cdb4591cef9c..6c6e5715112030130671b4d9de9d6802f4db90a7 100644 (file)
 /* 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
 
index 804538fbd2def54e7c8cb05b18cfc2d346b29693..5070689e625247970e1c75fcc53d0fa677581516 100644 (file)
@@ -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"
index 160bbcfebeb5424ca2bc2cd6b2f26a2f28bbd415..d6192610fef5c04f168f4f2d9b5fcabe26380599 100644 (file)
@@ -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
 
index 4a3041cef61f47d20e5f4c6381b205089b4e280f..838d67428dbb0a942ede93cbf11d06d21a4f7bd6 100644 (file)
@@ -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.
 
index c8cb11810b0525136823f675992424515796e42b..ab2cdac9e0c186b5b22be5e8b7a3850ff4c08e2b 100644 (file)
@@ -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>
index 71764a667e050bb3b4918a4d85e6b921311c3993..04fa50bd00baaa18e73800246bdeb3d0acb224b9 100644 (file)
@@ -1288,7 +1288,6 @@ set(epan_LIBS
        wiretap
        wsutil
 #      @SSL_LIBS@
-       ${PCRE_LIBRARIES}
        ${GLIB2_LIBRARIES}
        ${PCAP_LIBRARIES}
 #      @SOCKET_LIBS@
index 35b631d5a8a76396572fd7863b3bde2255ca64f8..4efc7924cc0fa5fa54db2e2fdc5fda6170b9d7eb 100644 (file)
@@ -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) \
index 388855205bdc6830f00ac5eec178c25bcbd7f672..b0a5847b8985006cb7ff51eee6dd246b01534b72 100644 (file)
@@ -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)
 
index 721dee92b489c20ee1a43af03d6ebd5864c6773f..ee966ca9de4812a0fea82e674d5191765d21a829 100644 (file)
@@ -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
 
index fb1c6494e01090d9df90a86048258d699c4834ed..f055c2dd7f195864588c0878b3330b1f303d691c 100644 (file)
@@ -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
index 67f39d22c61882c5923a92eae1880f8a74c91cfe..ffb0cf4b7a694508e3932c7317c353b743f70b38 100644 (file)
@@ -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         \
index f980bf273a6019c7a664390c7153ada711c8c984..11c983743dff42b09099169bf54a27b2f28ab538 100644 (file)
@@ -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 $<
index 95094810cd7fdc9115b1d8c5a6eaf44359ac0082..2b67f3d0be6c91c2602a7d828e56a8bea80b179e 100644 (file)
@@ -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)
index c94f541d26ab9fe471ea9eceea6e479c4e75d0ca..b330c4b0217b8e0cb090b6f6843211784080d0db 100644 (file)
@@ -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
 
 #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 */
                        &regex_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
  *
index 24ec502d9d1bd1737626137946d0ca75f1bd983e..3b9aaf30afe52b55525eeb387d2a4730b8a2c7b2 100644 (file)
@@ -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)
index f87c88eed501abe42a4cf70c56373adb13dca902..4e6cc970b260c2123130cce0af532ce002651db1 100644 (file)
@@ -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)
 {
index 0e8154e4000ba4a24552641d6bb123bbf7bafe03..23349c48ecd59ca0b5996f7ea492d4532b556448 100644 (file)
 #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);
index dd95df2720099cd2a1291e3431e6d679107a6c79..a3a22b874120401fe1832eec9a02c5b383b786a9 100644 (file)
@@ -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
index f4c880f3d893992b688b81610dd83ad56013fa6d..7a4f62b0189075eb5cb825be26c6f6799d2c3c8f 100644 (file)
 #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