diff options
author | Thiago Farina <tfarina@chromium.org> | 2012-06-30 14:40:10 (GMT) |
---|---|---|
committer | Thiago Farina <tfarina@chromium.org> | 2012-06-30 14:40:10 (GMT) |
commit | 904c9610fe66c4f4bd63a07d6f057c8603d24394 (patch) | |
tree | 96af9eca55928821a4d604302485ab0b33798579 /src/edit_distance.cc | |
parent | 358eefbce2f62e8685b6797d395c06f4118b6e05 (diff) | |
download | Ninja-904c9610fe66c4f4bd63a07d6f057c8603d24394.zip Ninja-904c9610fe66c4f4bd63a07d6f057c8603d24394.tar.gz Ninja-904c9610fe66c4f4bd63a07d6f057c8603d24394.tar.bz2 |
Make StringPiece data members private.
Signed-off-by: Thiago Farina <tfarina@chromium.org>
Diffstat (limited to 'src/edit_distance.cc')
-rw-r--r-- | src/edit_distance.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/edit_distance.cc b/src/edit_distance.cc index 22db4fe..50e641d 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; |