From 0e55fdf594c21db7759eaa3ac2fddbd6d80422b4 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 3 Nov 2011 18:59:56 +0900 Subject: [PATCH] Code cleanup --- src/uri.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/uri.cc b/src/uri.cc index 4b6ec80e..b1df0e52 100644 --- a/src/uri.cc +++ b/src/uri.cc @@ -125,11 +125,11 @@ bool parse(UriStruct& result, const std::string& uri) for(; queryFirst != fragmentFirst; ++queryFirst) { if(*queryFirst == '?') break; } - result.query = std::string(queryFirst, fragmentFirst); + result.query.assign(queryFirst, fragmentFirst); // find protocol std::string::size_type protocolOffset = uri.find("://"); if(protocolOffset == std::string::npos) return false; - result.protocol = std::string(uri.begin(), uri.begin()+protocolOffset); + result.protocol.assign(uri.begin(), uri.begin()+protocolOffset); uint16_t defPort; if((defPort = FeatureConfig::getInstance()-> getDefaultPort(result.protocol)) == 0) { @@ -221,9 +221,9 @@ bool parse(UriStruct& result, const std::string& uri) } } if(result.ipv6LiteralAddress) { - result.host = std::string(hostPortFirst+1, hostLast-1); + result.host.assign(hostPortFirst+1, hostLast-1); } else { - result.host = std::string(hostPortFirst, hostLast); + result.host.assign(hostPortFirst, hostLast); } // find directory and file part std::string::const_iterator dirLast = authorityLast; @@ -236,7 +236,7 @@ bool parse(UriStruct& result, const std::string& uri) if(dirLast == queryFirst) { result.file = A2STR::NIL; } else { - result.file = std::string(dirLast+1, queryFirst); + result.file.assign(dirLast+1, queryFirst); } // Erase duplicated slashes. std::string::const_iterator dirFirst = authorityLast; @@ -255,7 +255,7 @@ bool parse(UriStruct& result, const std::string& uri) if(dirFirst == dirLast) { result.dir = A2STR::SLASH_C; } else { - result.dir = std::string(dirFirst, dirLast); + result.dir.assign(dirFirst, dirLast); } return true; }