-rw-r--r-- | lib/discovery.cc | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/discovery.cc b/lib/discovery.cc index b7f2db6..5913ad4 100644 --- a/lib/discovery.cc +++ b/lib/discovery.cc @@ -8,2 +8,3 @@ #include <opkele/tidy.h> +#include <opkele/data.h> #include <opkele/debug.h> @@ -23,4 +24,2 @@ namespace opkele { - static const char *whitespace = " \t\r\n"; - static const char *i_leaders = "=@+$!("; static const size_t max_html = 16384; @@ -130,6 +129,6 @@ namespace opkele { idiscovery_t idis; - string::size_type fsc = identity.find_first_not_of(whitespace); + string::size_type fsc = identity.find_first_not_of(data::_whitespace_chars); if(fsc==string::npos) throw bad_input(OPKELE_CP_ "whitespace-only identity"); - string::size_type lsc = identity.find_last_not_of(whitespace); + string::size_type lsc = identity.find_last_not_of(data::_whitespace_chars); assert(lsc!=string::npos); @@ -141,3 +140,3 @@ namespace opkele { idis.clear(); - if(strchr(i_leaders,id[0])) { + if(strchr(data::_iname_leaders,id[0])) { /* TODO: further normalize xri identity? Like folding case @@ -497,3 +496,3 @@ namespace opkele { href.assign(ns); - string::size_type lns=href.find_last_not_of(whitespace); + string::size_type lns=href.find_last_not_of(data::_whitespace_chars); href.erase(lns+1); @@ -501,5 +500,5 @@ namespace opkele { } - for(string::size_type ns=rels.find_first_not_of(whitespace); - ns!=string::npos; ns=rels.find_first_not_of(whitespace,ns)) { - string::size_type s = rels.find_first_of(whitespace,ns); + for(string::size_type ns=rels.find_first_not_of(data::_whitespace_chars); + ns!=string::npos; ns=rels.find_first_not_of(data::_whitespace_chars,ns)) { + string::size_type s = rels.find_first_of(data::_whitespace_chars,ns); string rel; |