diff options
author | Anna Henningsen <anna@addaleax.net> | 2022-01-29 15:53:42 +0300 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2022-02-05 19:04:17 +0300 |
commit | e5084d33f0965ccf2a669fea6880b2a861f7f420 (patch) | |
tree | 2e8fa20639a8a5de2fd15be824dca02dcfb3659d /src/node_url.cc | |
parent | c18ad4b01297548582a04000aae5ba7d862377f5 (diff) |
src: slightly simplify URLHost::ToString
PR-URL: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'src/node_url.cc')
-rw-r--r-- | src/node_url.cc | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/node_url.cc b/src/node_url.cc index 708d79f8d80..49f93f5fa20 100644 --- a/src/node_url.cc +++ b/src/node_url.cc @@ -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; |