From 9181fbb6991418efe8887dcd0b672bb1f901c64a Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Tue, 23 Jan 2018 20:09:42 +0100 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/18324 Reviewed-By: Tiancheng "Timothy" Gu --- src/node_url.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/node_url.cc b/src/node_url.cc index 82d411d03cd530..0e5c395b130d52 100644 --- a/src/node_url.cc +++ b/src/node_url.cc @@ -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); } }; @@ -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, @@ -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