@@ -100,14 +100,16 @@ class URLHost { |
100 | 100 | // internals too much. |
101 | 101 | // These helpers are the easiest solution but we might want to consider |
102 | 102 | // just not forcing strings into an union. |
103 | | - inline void SetOpaque(std::string&& string) { |
| 103 | + inline void SetOpaque(std::string* string) { |
104 | 104 | type_ = HostType::H_OPAQUE; |
105 | | - new(&value_.opaque) std::string(std::move(string)); |
| 105 | + new(&value_.opaque) std::string(); |
| 106 | + value_.opaque.swap(*string); |
106 | 107 | } |
107 | 108 |
|
108 | | - inline void SetDomain(std::string&& string) { |
| 109 | + inline void SetDomain(std::string* string) { |
109 | 110 | type_ = HostType::H_DOMAIN; |
110 | | - new(&value_.domain) std::string(std::move(string)); |
| 111 | + new(&value_.domain) std::string(); |
| 112 | + value_.domain.swap(*string); |
111 | 113 | } |
112 | 114 | }; |
113 | 115 |
|
@@ -865,7 +867,7 @@ void URLHost::ParseOpaqueHost(const char* input, size_t length) { |
865 | 867 | } |
866 | 868 | } |
867 | 869 |
|
868 | | - SetOpaque(std::move(output)); |
| 870 | + SetOpaque(&output); |
869 | 871 | } |
870 | 872 |
|
871 | 873 | void URLHost::ParseHost(const char* input, |
@@ -913,7 +915,7 @@ void URLHost::ParseHost(const char* input, |
913 | 915 | return; |
914 | 916 |
|
915 | 917 | // It's not an IPv4 or IPv6 address, it must be a domain |
916 | | - SetDomain(std::move(decoded)); |
| 918 | + SetDomain(&decoded); |
917 | 919 | } |
918 | 920 |
|
919 | 921 | // Locates the longest sequence of 0 segments in an IPv6 address |
|