[Aptitude-svn-commit] r3687 - in branches/aptitude-0.3/aptitude: . src/generic

Daniel Burrows dburrows at costa.debian.org
Tue Jul 26 03:52:50 UTC 2005


Author: dburrows
Date: Tue Jul 26 03:52:48 2005
New Revision: 3687

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/generic/tags.cc
   branches/aptitude-0.3/aptitude/src/generic/tags.h
Log:
Strip whitespace from the front and the back of tags when constructing them.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Tue Jul 26 03:52:48 2005
@@ -1,5 +1,10 @@
 2005-07-25  Daniel Burrows  <dburrows at debian.org>
 
+	* src/generic/tags.cc:
+
+	  Strip whitespace from the front and back of tags upon
+	  construction.
+
 	* src/generic/tests/test_tags.cc:
 
 	  Add an operator<< implementation to write tags directly

Modified: branches/aptitude-0.3/aptitude/src/generic/tags.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/tags.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/generic/tags.cc	Tue Jul 26 03:52:48 2005
@@ -35,6 +35,16 @@
 
 using namespace std;
 
+tag::tag(const char *_start, const char *_finish)
+  :start(_start), finish(_finish)
+{
+  while(start != finish && isspace(*start))
+    ++start;
+
+  while(start != finish && isspace(*(finish-1)))
+    --finish;
+}
+
 // NB: this does the wrong thing if spaces occur within a tag (they
 // generate a new hierarchy level), but such tags are invalid anyway.
 tag::const_iterator &tag::const_iterator::operator++()

Modified: branches/aptitude-0.3/aptitude/src/generic/tags.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/tags.h	(original)
+++ branches/aptitude-0.3/aptitude/src/generic/tags.h	Tue Jul 26 03:52:48 2005
@@ -74,10 +74,7 @@
     }
   };
 
-  tag(const char *_start, const char *_finish)
-    :start(_start), finish(_finish)
-  {
-  }
+  tag(const char *_start, const char *_finish);
 
   tag &operator=(const tag &other)
   {



More information about the Aptitude-svn-commit mailing list