Improve error handling and get rid of a lingering fprintf().

This commit is contained in:
Wayne Davison committed 2009-09-05 10:25:42 -07:00
1 parent 59924aa8cf
commit 2f1fb732d4
1 file changed
+5 -6
+5 -6
View File
@@ -45,12 +45,12 @@ static void add_suffix(struct suffix_tree **prior, char ltr, const char *str)
if (ltr == '[') {
const char *after = strchr(str, ']');
/* Just skip bogus character classes. */
if (!after++)
/* Treat "[foo" and "[]" as having a literal '['. */
if (after && after++ != str+1) {
while ((ltr = *str++) != ']')
add_suffix(prior, ltr, after);
return;
while ((ltr = *str++) != ']')
add_suffix(prior, ltr, after);
return;
}
}
for (node = *prior; node; prior = &node->sibling, node = node->sibling) {
@@ -100,7 +100,6 @@ static void add_nocompress_suffixes(const char *str)
} while (*++f != '/' && *f);
*t++ = '\0';
fprintf(stderr, "adding `%s'\n", buf);
add_suffix(&suftree, *buf, buf+1);
}