]> sourceware.org Git - systemtap.git/commitdiff
levenshtein: skip empty strings
authorJonathan Lebon <jlebon@redhat.com>
Thu, 16 Jan 2014 22:29:49 +0000 (17:29 -0500)
committerJonathan Lebon <jlebon@redhat.com>
Wed, 22 Jan 2014 18:57:07 +0000 (13:57 -0500)
util.cxx

index 69ca139865ac553cfc65e3427fc05d3e3754f02a..5283c80847577ad145039399ac38f3e9cee524d9 100644 (file)
--- a/util.cxx
+++ b/util.cxx
@@ -1151,6 +1151,9 @@ levenshtein_suggest(const string& target,        // string to match against
   for (set<string>::const_iterator it = elems.begin();
                                       it != elems.end(); ++it)
     {
+      if (it->empty()) // skip empty strings
+        continue;
+
       // Approximate levenshtein by size-difference only; real score
       // is at least this high
       unsigned min_score = labs(target.size() - it->size());
This page took 0.030639 seconds and 5 git commands to generate.