diff options
author | Wayne Davison <wayned@samba.org> | 2009-09-05 10:25:42 -0700 |
---|---|---|
committer | Wayne Davison <wayned@samba.org> | 2009-09-05 10:25:42 -0700 |
commit | 2f1fb732d4be844fb68829bdc1c8c103f8b2df60 (patch) | |
tree | f690be32b2a04f7766e31d1c18e6b3ed07116273 | |
parent | 59924aa8cfd7f05c3305cc54dec906da82504e85 (diff) | |
download | android_external_rsync-2f1fb732d4be844fb68829bdc1c8c103f8b2df60.tar.gz android_external_rsync-2f1fb732d4be844fb68829bdc1c8c103f8b2df60.tar.bz2 android_external_rsync-2f1fb732d4be844fb68829bdc1c8c103f8b2df60.zip |
Improve error handling and get rid of a lingering fprintf().
-rw-r--r-- | token.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -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); } |