Skip to content

Commit

Permalink
src: slightly simplify URLHost::ToString
Browse files Browse the repository at this point in the history
PR-URL: #41747
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Mary Marchini <oss@mmarchini.me>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
addaleax authored and danielleadams committed Mar 14, 2022
1 parent 206c370 commit 5e59568
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/node_url.cc
Expand Up @@ -582,9 +582,7 @@ std::string URLHost::ToString() const {
dest.reserve(15);
uint32_t value = value_.ipv4;
for (int n = 0; n < 4; n++) {
char buf[4];
snprintf(buf, sizeof(buf), "%d", value % 256);
dest.insert(0, buf);
dest.insert(0, std::to_string(value % 256));
if (n < 3)
dest.insert(0, 1, '.');
value /= 256;
Expand Down

0 comments on commit 5e59568

Please sign in to comment.