From bffc7a2ac808d7dd93bcf4a9bb1a4898593a50c3 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 7 Sep 2014 17:14:03 -0400 Subject: [PATCH] Code Cleanup - Removed unused util.cpp combine function. --- src/util.cpp | 23 ----------------------- src/util.h | 3 --- test/util.t.cpp | 29 +---------------------------- 3 files changed, 1 insertion(+), 54 deletions(-) diff --git a/src/util.cpp b/src/util.cpp index e99ce81fc..21094061a 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -259,29 +259,6 @@ int flock (int fd, int operation) } #endif -//////////////////////////////////////////////////////////////////////////////// -void combine (std::vector & dest, const std::vector & source) -{ - // Create a map using the sequence elements as keys. This will create a - // unique list, with no duplicates. - std::map both; - std::vector ::iterator i1; - for (i1 = dest.begin (); i1 != dest.end (); ++i1) - both[*i1] = 0; - - std::vector ::const_iterator i2; - for (i2 = source.begin (); i2 != source.end (); ++i2) - both[*i2] = 0; - - // Now make a sequence out of the keys of the map. - dest.clear (); - std::map ::iterator i3; - for (i3 = both.begin (); i3 != both.end (); ++i3) - dest.push_back (i3->first); - - std::sort (dest.begin (), dest.end ()); -} - //////////////////////////////////////////////////////////////////////////////// // Run a binary with args, capturing output. int execute ( diff --git a/src/util.h b/src/util.h index 0a1647318..3dbb51dbc 100644 --- a/src/util.h +++ b/src/util.h @@ -61,11 +61,8 @@ int execute (const std::string&, const std::vector &, const std::st int flock (int, int); #endif -void combine (std::vector &, const std::vector &); - const std::string encode (const std::string&); const std::string decode (const std::string&); - const std::string escape (const std::string&, char); const std::vector indentTree ( diff --git a/test/util.t.cpp b/test/util.t.cpp index a39be4d11..4de89d7cd 100644 --- a/test/util.t.cpp +++ b/test/util.t.cpp @@ -36,7 +36,7 @@ Context context; //////////////////////////////////////////////////////////////////////////////// int main (int argc, char** argv) { - UnitTest t (40); + UnitTest t (29); // Ensure environment has no influence. unsetenv ("TASKDATA"); @@ -89,33 +89,6 @@ int main (int argc, char** argv) output = taskDifferences (right, rightAgain); t.ok (output.find ("No changes will be made") != std::string::npos, "No changes detected"); - // void combine (std::vector &, const std::vector &); - std::vector vleft; - vleft.push_back (1); - vleft.push_back (2); - vleft.push_back (3); - - std::vector vright; - vright.push_back (4); - - combine (vleft, vright); - t.is (vleft.size (), (size_t)4, "1,2,3 + 4 -> [4]"); - t.is (vleft[0], 1, "1,2,3 + 4 -> 1,2,3,4"); - t.is (vleft[1], 2, "1,2,3 + 4 -> 1,2,3,4"); - t.is (vleft[2], 3, "1,2,3 + 4 -> 1,2,3,4"); - t.is (vleft[3], 4, "1,2,3 + 4 -> 1,2,3,4"); - - vright.push_back (3); - vright.push_back (5); - combine (vleft, vright); - - t.is (vleft.size (), (size_t)5, "1,2,3,4 + 3,4,5 -> [5]"); - t.is (vleft[0], 1, "1,2,3,4 + 3,4,5 -> 1,2,3,4,5"); - t.is (vleft[1], 2, "1,2,3,4 + 3,4,5 -> 1,2,3,4,5"); - t.is (vleft[2], 3, "1,2,3,4 + 3,4,5 -> 1,2,3,4,5"); - t.is (vleft[3], 4, "1,2,3,4 + 3,4,5 -> 1,2,3,4,5"); - t.is (vleft[4], 5, "1,2,3,4 + 3,4,5 -> 1,2,3,4,5"); - // see also indirect tests of indentProject and extractParents in `project.t'. // std::vector indentTree (const std::vector&, const std::string whitespace=" ", char delimiter='.'); std::vector flat;