Skip to content

Commit 9181fbb

Browse files
addaleaxMylesBorins
authored andcommitted
src: dumb down code by removing std::move
This would require C++11 features that would otherwise not be available on clang + OS X on Node 6.x. PR-URL: #18324 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
1 parent 57865a9 commit 9181fbb

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/node_url.cc

+8-6
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,16 @@ class URLHost {
100100
// internals too much.
101101
// These helpers are the easiest solution but we might want to consider
102102
// just not forcing strings into an union.
103-
inline void SetOpaque(std::string&& string) {
103+
inline void SetOpaque(std::string* string) {
104104
type_ = HostType::H_OPAQUE;
105-
new(&value_.opaque) std::string(std::move(string));
105+
new(&value_.opaque) std::string();
106+
value_.opaque.swap(*string);
106107
}
107108

108-
inline void SetDomain(std::string&& string) {
109+
inline void SetDomain(std::string* string) {
109110
type_ = HostType::H_DOMAIN;
110-
new(&value_.domain) std::string(std::move(string));
111+
new(&value_.domain) std::string();
112+
value_.domain.swap(*string);
111113
}
112114
};
113115

@@ -865,7 +867,7 @@ void URLHost::ParseOpaqueHost(const char* input, size_t length) {
865867
}
866868
}
867869

868-
SetOpaque(std::move(output));
870+
SetOpaque(&output);
869871
}
870872

871873
void URLHost::ParseHost(const char* input,
@@ -913,7 +915,7 @@ void URLHost::ParseHost(const char* input,
913915
return;
914916

915917
// It's not an IPv4 or IPv6 address, it must be a domain
916-
SetDomain(std::move(decoded));
918+
SetDomain(&decoded);
917919
}
918920

919921
// Locates the longest sequence of 0 segments in an IPv6 address

0 commit comments

Comments
 (0)