]> git.cworth.org Git - wordgame/commitdiff
dict: Fix bug in for_each iterations with no max_length limit
authorCarl Worth <cworth@cworth.org>
Tue, 19 Dec 2006 15:57:34 +0000 (07:57 -0800)
committerCarl Worth <cworth@cworth.org>
Tue, 19 Dec 2006 15:57:34 +0000 (07:57 -0800)
We've been using an idiom of min_length == 0, max_length == 0 to
indicate no length limit, but this has apparently been broken since
the rework of the for_each interfaces that introduced this.

dict.c

diff --git a/dict.c b/dict.c
index 11ddaf1ebd1afe73db7ede92b7438c4622dd01f3..b2ad4952c9604f6990f095a35d846167499f38ad 100644 (file)
--- a/dict.c
+++ b/dict.c
@@ -231,7 +231,7 @@ trie_for_each_of_length_if (trie_t          *trie,
            action (closure, string->s, &trie->flags);
     }
 
            action (closure, string->s, &trie->flags);
     }
 
-    if (length == max_length)
+    if (max_length > 0 && length == max_length)
        return count;
 
     /* Loop over each element, appending the character and recursing. */
        return count;
 
     /* Loop over each element, appending the character and recursing. */