Skip to content

Commit

Permalink
src: dumb down code by removing std::move
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
addaleax authored and MylesBorins committed Feb 13, 2018
1 parent 57865a9 commit 9181fbb
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/node_url.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,16 @@ class URLHost {
// internals too much.
// These helpers are the easiest solution but we might want to consider
// just not forcing strings into an union.
inline void SetOpaque(std::string&& string) {
inline void SetOpaque(std::string* string) {
type_ = HostType::H_OPAQUE;
new(&value_.opaque) std::string(std::move(string));
new(&value_.opaque) std::string();
value_.opaque.swap(*string);
}

inline void SetDomain(std::string&& string) {
inline void SetDomain(std::string* string) {
type_ = HostType::H_DOMAIN;
new(&value_.domain) std::string(std::move(string));
new(&value_.domain) std::string();
value_.domain.swap(*string);
}
};

Expand Down Expand Up @@ -865,7 +867,7 @@ void URLHost::ParseOpaqueHost(const char* input, size_t length) {
}
}

SetOpaque(std::move(output));
SetOpaque(&output);
}

void URLHost::ParseHost(const char* input,
Expand Down Expand Up @@ -913,7 +915,7 @@ void URLHost::ParseHost(const char* input,
return;

// It's not an IPv4 or IPv6 address, it must be a domain
SetDomain(std::move(decoded));
SetDomain(&decoded);
}

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

0 comments on commit 9181fbb

Please sign in to comment.