Make ImmutableString(const std::string&) explicit

This commit is contained in:
Tatsuhiro Tsujikawa 2016-08-26 22:52:08 +09:00
parent 39c068974d
commit 13d3f785bd
3 changed files with 5 additions and 4 deletions

View File

@ -791,7 +791,8 @@ int create_tcp_server_socket(UpstreamAddr &faddr,
} }
faddr.fd = fd; faddr.fd = fd;
faddr.hostport = util::make_http_hostport(StringRef{host.data()}, faddr.port); faddr.hostport = ImmutableString{
util::make_http_hostport(StringRef{host.data()}, faddr.port)};
LOG(NOTICE) << "Listening on " << faddr.hostport LOG(NOTICE) << "Listening on " << faddr.hostport
<< (faddr.tls ? ", tls" : ""); << (faddr.tls ? ", tls" : "");

View File

@ -2049,7 +2049,7 @@ int parse_config(Config *config, int optid, const StringRef &opt,
LOG(ERROR) << opt << ": Couldn't read key file's passwd from " << optarg; LOG(ERROR) << opt << ": Couldn't read key file's passwd from " << optarg;
return -1; return -1;
} }
config->tls.private_key_passwd = passwd; config->tls.private_key_passwd = ImmutableString{passwd};
return 0; return 0;
} }
@ -2958,7 +2958,7 @@ int configure_downstream_group(Config *config, bool http2_proxy,
auto &sni = tlsconf.backend_sni_name; auto &sni = tlsconf.backend_sni_name;
for (auto &addr_group : addr_groups) { for (auto &addr_group : addr_groups) {
for (auto &addr : addr_group.addrs) { for (auto &addr : addr_group.addrs) {
addr.sni = sni; addr.sni = ImmutableString{sni};
} }
} }
} }

View File

@ -257,7 +257,7 @@ public:
: len(slen), base(copystr(s, s + len)) {} : len(slen), base(copystr(s, s + len)) {}
explicit ImmutableString(const char *s) explicit ImmutableString(const char *s)
: len(strlen(s)), base(copystr(s, s + len)) {} : len(strlen(s)), base(copystr(s, s + len)) {}
ImmutableString(const std::string &s) explicit ImmutableString(const std::string &s)
: len(s.size()), base(copystr(std::begin(s), std::end(s))) {} : len(s.size()), base(copystr(std::begin(s), std::end(s))) {}
template <typename InputIt> template <typename InputIt>
ImmutableString(InputIt first, InputIt last) ImmutableString(InputIt first, InputIt last)