1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-14 18:19:11 +00:00

Codechange: pass large objects by reference instead of value

Especially when they get passed on directly to the next function or via a
constructor into an instance variable
This commit is contained in:
Rubidium
2023-01-28 13:02:05 +01:00
committed by rubidium42
parent dbc666905d
commit ed7685910d
3 changed files with 10 additions and 10 deletions

View File

@@ -115,7 +115,7 @@ private:
public:
TCPConnecter() {};
TCPConnecter(const std::string &connection_string, uint16 default_port, NetworkAddress bind_address = {}, int family = AF_UNSPEC);
TCPConnecter(const std::string &connection_string, uint16 default_port, const NetworkAddress &bind_address = {}, int family = AF_UNSPEC);
virtual ~TCPConnecter();
/**

View File

@@ -29,7 +29,7 @@ static std::vector<TCPConnecter *> _tcp_connecters;
* @param default_port If not indicated in connection_string, what port to use.
* @param bind_address The local bind address to use. Defaults to letting the OS find one.
*/
TCPConnecter::TCPConnecter(const std::string &connection_string, uint16 default_port, NetworkAddress bind_address, int family) :
TCPConnecter::TCPConnecter(const std::string &connection_string, uint16 default_port, const NetworkAddress &bind_address, int family) :
bind_address(bind_address),
family(family)
{