aboutsummaryrefslogtreecommitdiffstats
path: root/libdevcore/StringUtils.h
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-08-15 16:49:39 +0800
committerGitHub <noreply@github.com>2018-08-15 16:49:39 +0800
commitb9752b236b474e384a297fe832cf0efb161e8deb (patch)
tree5c5d61fae37024a3ba2fea5bd7eaf0d455e6e043 /libdevcore/StringUtils.h
parent3c5226cefb9f883277530decedc08e2e48ed3050 (diff)
parent3fa8829845bf55df812f81356a3ec43149836bb5 (diff)
downloaddexon-solidity-b9752b236b474e384a297fe832cf0efb161e8deb.tar.gz
dexon-solidity-b9752b236b474e384a297fe832cf0efb161e8deb.tar.zst
dexon-solidity-b9752b236b474e384a297fe832cf0efb161e8deb.zip
Merge pull request #4797 from bakaoh/issue4718
Fixes #4718: High CPU usage when using large variable names
Diffstat (limited to 'libdevcore/StringUtils.h')
-rw-r--r--libdevcore/StringUtils.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/libdevcore/StringUtils.h b/libdevcore/StringUtils.h
index f05a426b..b02b9d12 100644
--- a/libdevcore/StringUtils.h
+++ b/libdevcore/StringUtils.h
@@ -30,7 +30,8 @@ namespace dev
{
// Calculates the Damerau–Levenshtein distance between _str1 and _str2 and returns true if that distance is not greater than _maxDistance
-bool stringWithinDistance(std::string const& _str1, std::string const& _str2, size_t _maxDistance);
+// if _lenThreshold > 0 and the product of the strings length is greater than _lenThreshold, the function will return false
+bool stringWithinDistance(std::string const& _str1, std::string const& _str2, size_t _maxDistance, size_t _lenThreshold = 0);
// Calculates the Damerau–Levenshtein distance between _str1 and _str2
size_t stringDistance(std::string const& _str1, std::string const& _str2);
// Return a string having elements of suggestions as quoted, alternative suggestions. e.g. "a", "b" or "c"