summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorClark Barrett <clarkbarrett@google.com>2015-04-21 16:34:15 -0700
committerClark Barrett <clarkbarrett@google.com>2015-04-21 16:34:15 -0700
commitd95fe7675e20eaee86b8e804469e6db83265a005 (patch)
tree34616ecdc217d608b97d9432a368b20c75039542 /src/util
parent22601bce9648a8e784527e4e5d176f634d234797 (diff)
Changes needed to compile at Google, plus some bug fixes from Google.
Diffstat (limited to 'src/util')
-rw-r--r--src/util/didyoumean.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/util/didyoumean.cpp b/src/util/didyoumean.cpp
index 228fe721e..dd8941033 100644
--- a/src/util/didyoumean.cpp
+++ b/src/util/didyoumean.cpp
@@ -77,7 +77,12 @@ int DidYouMean::editDistance(const std::string& a, const std::string& b)
int len1 = a.size();
int len2 = b.size();
- int C[3][len2+1]; // cost
+ int* C[3];
+ int ii;
+ for (ii = 0; ii < 3; ++ii) {
+ C[ii] = new int[len2+1];
+ }
+ // int C[3][len2+1]; // cost
for(int j = 0; j <= len2; ++j) {
C[0][j] = j * addCost;
@@ -123,7 +128,11 @@ int DidYouMean::editDistance(const std::string& a, const std::string& b)
}
}
- return C[len1%3][len2];
+ int result = C[len1%3][len2];
+ for (ii = 0; ii < 3; ++ii) {
+ delete [] C[ii];
+ }
+ return result;
}
string DidYouMean::getMatchAsString(string input, int prefixNewLines, int suffixNewLines) {
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback