summaryrefslogtreecommitdiffstats
path: root/src/edit_distance.cc
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2012-07-28 16:56:59 (GMT)
committerNico Weber <nicolasweber@gmx.de>2012-07-28 16:56:59 (GMT)
commit957a801ace27426f3ceb544449f882dba1924161 (patch)
tree6a212b102467312452e89dc5472c2e4230f1cbc6 /src/edit_distance.cc
parent3ab35e5403066f48117f442f9ba8853e70edab13 (diff)
downloadNinja-957a801ace27426f3ceb544449f882dba1924161.zip
Ninja-957a801ace27426f3ceb544449f882dba1924161.tar.gz
Ninja-957a801ace27426f3ceb544449f882dba1924161.tar.bz2
Revert "Make StringPiece data members private."
This reverts commit 904c9610fe66c4f4bd63a07d6f057c8603d24394. The commit caused issue #380, this revert fixes it. The revert also makes the test from the previous commit pass.
Diffstat (limited to 'src/edit_distance.cc')
-rw-r--r--src/edit_distance.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/edit_distance.cc b/src/edit_distance.cc
index 50e641d..22db4fe 100644
--- a/src/edit_distance.cc
+++ b/src/edit_distance.cc
@@ -29,8 +29,8 @@ int EditDistance(const StringPiece& s1,
// Although the algorithm is typically described using an m x n
// array, only two rows are used at a time, so this implemenation
// just keeps two separate vectors for those two rows.
- int m = s1.len();
- int n = s2.len();
+ int m = s1.len_;
+ int n = s2.len_;
std::vector<int> previous(n + 1);
std::vector<int> current(n + 1);
@@ -44,11 +44,11 @@ int EditDistance(const StringPiece& s1,
for (int x = 1; x <= n; ++x) {
if (allow_replacements) {
- current[x] = min(previous[x-1] + (s1.str()[y-1] == s2.str()[x-1] ?
- 0 : 1), min(current[x-1], previous[x]) + 1);
+ current[x] = min(previous[x-1] + (s1.str_[y-1] == s2.str_[x-1] ? 0 : 1),
+ min(current[x-1], previous[x])+1);
}
else {
- if (s1.str()[y-1] == s2.str()[x-1])
+ if (s1.str_[y-1] == s2.str_[x-1])
current[x] = previous[x-1];
else
current[x] = min(current[x-1], previous[x]) + 1;