gnome-system-monitor r2290 - in trunk: . src



Author: bdejean
Date: Thu Jan 31 23:17:53 2008
New Revision: 2290
URL: http://svn.gnome.org/viewvc/gnome-system-monitor?rev=2290&view=rev

Log:
Bye-bye pcrecpp :/
Moved to Glib although it's still incomplete (had to use g_regex).


Removed:
   trunk/src/regex.h
Modified:
   trunk/configure.in
   trunk/src/Makefile.am
   trunk/src/sysinfo.cpp

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Thu Jan 31 23:17:53 2008
@@ -30,7 +30,6 @@
 GTK_REQUIRED=2.12.0
 GNOME_VFS_REQUIRED=2.6.0
 GNOME_ICON_THEME_REQUIRED=2.15.3
-PCRECPP_REQUIRED=6.4
 GTKMM_REQUIRED=2.8
 GLIBMM_REQUIRED=2.14
 LIBXML_REQUIRED=2.0
@@ -39,23 +38,6 @@
 PKG_CHECK_MODULES(PROCMAN, glib-2.0 >= $GLIB_REQUIRED gconf-2.0 >= $GCONF_REQUIRED libgtop-2.0 >= $LIBGTOP_REQUIRED libwnck-1.0 >= $LIBWNCK_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED gtkmm-2.4 >= $GTKMM_REQUIRED libxml-2.0 >= $LIBXML_REQUIRED librsvg-2.0 >= $RSVG_REQUIRED glibmm-2.4 >= $GLIBMM_REQUIRED)
 
 
-AC_ARG_ENABLE([pcrecpp], AS_HELP_STRING([--enable-pcrecpp], [Enable pcrecpp. You really want this ! (but default: disabled)]), [enable_pcrecpp=$enableval], [enable_pcrecpp=no])
-
-if test "x$enable_pcrecpp" = "xyes" ; then
-   PKG_CHECK_MODULES(PCRECPP, libpcre >= $PCRECPP_REQUIRED)
-   enable_pcrecpp=yes
-   AC_DEFINE(HAVE_PCRECPP, 1, [Defined if you have pcrecpp])
-   PCRECPP_LIBS="${PCRECPP_LIBS} -lpcrecpp"
-else
-   enable_pcrecpp=no
-   PCRECPP_CFLAGS=
-   PCRECPP_LIBS=
-fi
-
-AC_SUBST(PCRECPP_CFLAGS)
-AC_SUBST(PCRECPP_LIBS)
-
-
 AC_ARG_ENABLE(more-warnings,
 [AC_HELP_STRING([--enable-more-warnings], [Maximum compiler warnings])],
 set_more_warnings="$enableval",[
@@ -114,7 +96,6 @@
 	C++ Compiler:		${CXX}
 	CFLAGS:			${CFLAGS}
 	CXXFLAGS:		${CXXFLAGS}
-	pcrecpp:		${enable_pcrecpp}
 	Maintainer mode:	${USER_MAINTAINER_MODE}
 	Languages:		${ALL_LINGUAS}
 "

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Thu Jan 31 23:17:53 2008
@@ -4,13 +4,11 @@
 	-DPROCMAN_DATADIR=\""$(datadir)/procman/"\" \
 	-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
 	-DDATADIR=\""$(datadir)"\" \
-	@PROCMAN_CFLAGS@ \
-	@PCRECPP_CFLAGS@
+	@PROCMAN_CFLAGS@
 
 bin_PROGRAMS = gnome-system-monitor
 
 gnome_system_monitor_SOURCES = \
-	regex.h \
 	procman.cpp  procman.h \
 	interface.cpp interface.h \
 	callbacks.cpp callbacks.h \
@@ -37,7 +35,7 @@
         gsm_color_button.c gsm_color_button.h
 
 
-gnome_system_monitor_LDADD = @PROCMAN_LIBS@ @PCRECPP_LIBS@ libbacon.la
+gnome_system_monitor_LDADD = @PROCMAN_LIBS@ libbacon.la
 
 
 noinst_LTLIBRARIES = libbacon.la

Modified: trunk/src/sysinfo.cpp
==============================================================================
--- trunk/src/sysinfo.cpp	(original)
+++ trunk/src/sysinfo.cpp	Thu Jan 31 23:17:53 2008
@@ -1,6 +1,7 @@
 #include <config.h>
 
 #include <glib.h>
+#include <glibmm.h>
 #include <glib/gi18n.h>
 
 #include <libxml/parser.h>
@@ -19,8 +20,6 @@
 #include <math.h>
 #include <errno.h>
 
-#include "regex.h"
-
 #include <string>
 #include <vector>
 #include <fstream>
@@ -196,7 +195,7 @@
   {
   public:
     LSBSysInfo()
-      : re("^.+?:\\s*(.+)\\s*$")
+      : re(Glib::Regex::create("^.+?:\\s*(.+)\\s*$"))
     {
       this->lsb_release();
     }
@@ -205,8 +204,13 @@
 
     void strip_description(string &s) const
     {
-      // make a copy to avoid aliasing
-      this->re.PartialMatch(string(s), &s);
+      const GRegexMatchFlags flags = static_cast<GRegexMatchFlags>(0);
+      GMatchInfo* info = 0;
+
+      if (g_regex_match(this->re->gobj(), s.c_str(), flags, &info)) {
+	s = make_string(g_match_info_fetch(info, 1));
+	g_match_info_free(info);
+      }
     }
 
     std::istream& get_value(std::istream &is, string &s) const
@@ -246,7 +250,7 @@
     }
 
   private:
-    const pcrecpp::RE re;
+    Glib::RefPtr<Glib::Regex> re;
   };
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]