Commit 2f1fb732 authored by Wayne Davison's avatar Wayne Davison

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

parent 59924aa8
...@@ -45,12 +45,12 @@ static void add_suffix(struct suffix_tree **prior, char ltr, const char *str) ...@@ -45,12 +45,12 @@ static void add_suffix(struct suffix_tree **prior, char ltr, const char *str)
if (ltr == '[') { if (ltr == '[') {
const char *after = strchr(str, ']'); const char *after = strchr(str, ']');
/* Just skip bogus character classes. */ /* Treat "[foo" and "[]" as having a literal '['. */
if (!after++) if (after && after++ != str+1) {
while ((ltr = *str++) != ']')
add_suffix(prior, ltr, after);
return; return;
while ((ltr = *str++) != ']') }
add_suffix(prior, ltr, after);
return;
} }
for (node = *prior; node; prior = &node->sibling, node = node->sibling) { for (node = *prior; node; prior = &node->sibling, node = node->sibling) {
...@@ -100,7 +100,6 @@ static void add_nocompress_suffixes(const char *str) ...@@ -100,7 +100,6 @@ static void add_nocompress_suffixes(const char *str)
} while (*++f != '/' && *f); } while (*++f != '/' && *f);
*t++ = '\0'; *t++ = '\0';
fprintf(stderr, "adding `%s'\n", buf);
add_suffix(&suftree, *buf, buf+1); add_suffix(&suftree, *buf, buf+1);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment