--- htdig-3.2.0b6/htfuzzy/Regexp.cc.orig 2004-05-28 08:15:20.000000000 -0500
+++ htdig-3.2.0b6/htfuzzy/Regexp.cc 2007-03-06 15:48:03.000000000 -0600
@@ -73,16 +73,16 @@
int wordCount = 0;
int maximumWords = config.Value("regex_max_words", 25);
- wordList->Start_Get();
- while (wordCount < maximumWords && (key = (String *) wordList->Get_Next()))
- {
- if (regexMatch.match(*key, 0, 0) != 0)
- {
- words.Add(new String(*key));
- wordCount++;
- }
- }
if (wordList) {
+ wordList->Start_Get();
+ while (wordCount < maximumWords && (key = (String *) wordList->Get_Next()))
+ {
+ if (regexMatch.match(*key, 0, 0) != 0)
+ {
+ words.Add(new String(*key));
+ wordCount++;
+ }
+ }
wordList->Destroy();
delete wordList;
}
--- htdig-3.2.0b6/htfuzzy/Substring.cc.orig 2004-05-28 08:15:20.000000000 -0500
+++ htdig-3.2.0b6/htfuzzy/Substring.cc 2007-03-06 15:48:34.000000000 -0600
@@ -73,16 +73,16 @@
int wordCount = 0;
int maximumWords = config.Value("substring_max_words", 25);
- wordList->Start_Get();
- while (wordCount < maximumWords && (key = (String *) wordList->Get_Next()))
- {
- if (match.FindFirst((char*)*key) >= 0)
- {
- words.Add(new String(*key));
- wordCount++;
- }
- }
if (wordList) {
+ wordList->Start_Get();
+ while (wordCount < maximumWords && (key = (String *) wordList->Get_Next()))
+ {
+ if (match.FindFirst((char*)*key) >= 0)
+ {
+ words.Add(new String(*key));
+ wordCount++;
+ }
+ }
wordList->Destroy();
delete wordList;
}
--- htdig-3.2.0b6/htfuzzy/htfuzzy.cc.orig 2004-05-28 08:15:20.000000000 -0500
+++ htdig-3.2.0b6/htfuzzy/htfuzzy.cc 2007-03-06 15:53:04.000000000 -0600
@@ -153,8 +153,9 @@
String word, fuzzyKey;
int count = 0;
- words->Start_Get();
- while ((key = (String *) words->Get_Next()))
+ if (words)
+ words->Start_Get();
+ while (words && (key = (String *) words->Get_Next()))
{
word = *key;
wordAlgorithms.Start_Get();
@@ -185,8 +186,11 @@
fuzzy->writeDB();
}
worddb.Close();
- words->Destroy();
- delete words;
+ if (words)
+ {
+ words->Destroy();
+ delete words;
+ }
if (fuzzy)
delete fuzzy;
}
--- htdig-3.2.0b6/htfuzzy/Prefix.cc.orig 2004-05-28 08:15:20.000000000 -0500
+++ htdig-3.2.0b6/htfuzzy/Prefix.cc 2007-03-06 15:58:13.000000000 -0600
@@ -99,9 +99,10 @@
WordReference *word_ref;
String last_word;
- wordList->Start_Get();
- while (wordCount < maximumWords && (word_ref = (WordReference *) wordList->Get_Next() ))
- {
+ if (wordList) {
+ wordList->Start_Get();
+ while (wordCount < maximumWords && (word_ref = (WordReference *) wordList->Get_Next() ))
+ {
s = word_ref->Key().GetWord();
// If we're somehow past the original word, we're done
@@ -115,8 +116,7 @@
last_word = s;
words.Add(new String(s));
wordCount++;
- }
- if (wordList) {
+ }
wordList->Destroy();
delete wordList;
}
--- htdig-3.2.0b6/htfuzzy/Fuzzy.cc.orig 2004-05-28 08:15:20.000000000 -0500
+++ htdig-3.2.0b6/htfuzzy/Fuzzy.cc 2007-03-06 12:51:54.000000000 -0600
@@ -61,7 +61,11 @@
delete index;
index = 0;
}
- delete dict;
+ if (dict)
+ {
+ delete dict;
+ dict = 0;
+ }
}
@@ -154,8 +158,9 @@
int count = 0;
- dict->Start_Get();
- while ((fuzzyKey = dict->Get_Next()))
+ if (dict)
+ dict->Start_Get();
+ while (dict && (fuzzyKey = dict->Get_Next()))
{
s = (String *) dict->Find(fuzzyKey);
index->Put(fuzzyKey, *s);