diff options
author | rubidium42 <rubidium@openttd.org> | 2021-06-13 21:05:15 +0200 |
---|---|---|
committer | rubidium42 <rubidium42@users.noreply.github.com> | 2021-06-15 06:13:00 +0200 |
commit | 667301e3ecc39ecd6bce286fafe25247d774642f (patch) | |
tree | 1ce0a0f24272e5ac8ff7cf0ce58b4d0c07e18034 /src/network/core/address.cpp | |
parent | a91e29b656d91b1f1c6a906ee8e81ddd716723aa (diff) | |
download | openttd-667301e3ecc39ecd6bce286fafe25247d774642f.tar.xz |
Codechange: [Network] Make hostname/client IP return strings instead of a C-string
Diffstat (limited to 'src/network/core/address.cpp')
-rw-r--r-- | src/network/core/address.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/network/core/address.cpp b/src/network/core/address.cpp index ba9ae69fc..0c16a2c3c 100644 --- a/src/network/core/address.cpp +++ b/src/network/core/address.cpp @@ -19,7 +19,7 @@ * IPv4 dotted representation is given. * @return the hostname */ -const char *NetworkAddress::GetHostname() +const std::string &NetworkAddress::GetHostname() { if (this->hostname.empty() && this->address.ss_family != AF_UNSPEC) { assert(this->address_length != 0); @@ -27,7 +27,7 @@ const char *NetworkAddress::GetHostname() getnameinfo((struct sockaddr *)&this->address, this->address_length, buffer, sizeof(buffer), nullptr, 0, NI_NUMERICHOST); this->hostname = buffer; } - return this->hostname.c_str(); + return this->hostname; } /** |