GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: dumb down code by removing std::move · nodejs/node@9181fbb

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • node_url.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/node_url.cc‎

Copy file name to clipboardExpand all lines: src/node_url.cc
+8-6Lines changed: 8 additions & 6 deletions
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 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.