From 3a7fa1660c3d78f1f80f3502a8dae77642d3c3f9 Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 12 Mar 2006 16:56:02 +0000 Subject: [PATCH] Const refs (this is about the last of them in the core api) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3694 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/ctables.h | 2 +- include/dns.h | 10 +++++----- include/dnsqueue.h | 2 +- include/inspircd_io.h | 2 +- include/u_listmode.h | 2 +- src/dns.cpp | 10 +++++----- src/dnsqueue.cpp | 2 +- src/inspircd_io.cpp | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/ctables.h b/include/ctables.h index 7fca885bc..d98e1701d 100644 --- a/include/ctables.h +++ b/include/ctables.h @@ -59,7 +59,7 @@ class command_t */ std::string source; - command_t(std::string cmd, char flags, int minpara) : command(cmd), flags_needed(flags), min_params(minpara) + command_t(const std::string &cmd, char flags, int minpara) : command(cmd), flags_needed(flags), min_params(minpara) { use_count = total_bytes = 0; source = ""; diff --git a/include/dns.h b/include/dns.h index 91e655775..cdc1fd024 100644 --- a/include/dns.h +++ b/include/dns.h @@ -65,7 +65,7 @@ public: /** This constructor accepts a dns server address. The address must be in dotted * decimal form, e.g. 1.2.3.4. */ - DNS(std::string dnsserver); + DNS(const std::string &dnsserver); /** The destructor frees all used structures. */ ~DNS(); @@ -73,14 +73,14 @@ public: * format, e.g. 1.2.3.4, and returns true if the lookup was successfully * initiated. */ - bool ReverseLookup(std::string ip); + bool ReverseLookup(const std::string &ip); /** This method will start the forward lookup of a hostname, e.g. www.inspircd.org, * and returns true if the lookup was successfully initiated. */ - bool ForwardLookup(std::string host); + bool ForwardLookup(const std::string &host); /** Used by modules to perform a dns lookup but have the socket engine poll a module, instead of the dns object directly. */ - bool ForwardLookupWithFD(std::string host, int &fd); + bool ForwardLookupWithFD(const std::string &host, int &fd); /** This method will return true when the lookup is completed. It uses poll internally * to determine the status of the socket. */ @@ -97,7 +97,7 @@ public: * query is invalid for some reason, e.g. the dns server not responding. */ int GetFD(); - void SetNS(std::string dnsserver); + void SetNS(const std::string &dnsserver); }; /** This is the handler function for multi-threaded DNS. diff --git a/include/dnsqueue.h b/include/dnsqueue.h index f251dcaa2..2b3217847 100644 --- a/include/dnsqueue.h +++ b/include/dnsqueue.h @@ -1,5 +1,5 @@ #include "inspircd.h" #include "users.h" -bool lookup_dns(std::string nick); +bool lookup_dns(const std::string &nick); void dns_poll(int fdcheck); diff --git a/include/inspircd_io.h b/include/inspircd_io.h index ac0587177..e4b5f98a3 100644 --- a/include/inspircd_io.h +++ b/include/inspircd_io.h @@ -372,7 +372,7 @@ int DaemonSeed (void); bool FileExists (const char* file); int OpenTCPSocket (void); int BindSocket (int sockfd, struct sockaddr_in client, struct sockaddr_in server, int port, char* addr); -void WritePID(std::string filename); +void WritePID(const std::string &filename); int BindPorts(); char* CleanFilename(char* name); diff --git a/include/u_listmode.h b/include/u_listmode.h index bd212c528..a41f30e68 100644 --- a/include/u_listmode.h +++ b/include/u_listmode.h @@ -56,7 +56,7 @@ protected: Server* Srv; ConfigReader* Conf; public: - ListModeBaseModule(Server* serv, char modechar, std::string eolstr, std::string lnum, std::string eolnum) : Module::Module(serv) + ListModeBaseModule(Server* serv, char modechar, const std::string &eolstr, const std::string &lnum, const std::string &eolnum) : Module::Module(serv) { Srv = serv; Conf = new ConfigReader; diff --git a/src/dns.cpp b/src/dns.cpp index ef3eb704e..dc25fe8fe 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -684,13 +684,13 @@ DNS::DNS() log(DEBUG,"Create blank DNS"); } -DNS::DNS(std::string dnsserver) +DNS::DNS(const std::string &dnsserver) { dns_init_2(dnsserver.c_str()); log(DEBUG,"Create DNS with server '%s'",dnsserver.c_str()); } -void DNS::SetNS(std::string dnsserver) +void DNS::SetNS(const std::string &dnsserver) { dns_init_2(dnsserver.c_str()); log(DEBUG,"Set NS"); @@ -700,7 +700,7 @@ DNS::~DNS() { } -bool DNS::ReverseLookup(std::string ip) +bool DNS::ReverseLookup(const std::string &ip) { if (ServerInstance && ServerInstance->stats) ServerInstance->stats->statsDns++; @@ -723,7 +723,7 @@ bool DNS::ReverseLookup(std::string ip) return true; } -bool DNS::ForwardLookup(std::string host) +bool DNS::ForwardLookup(const std::string &host) { if (ServerInstance && ServerInstance->stats) ServerInstance->stats->statsDns++; @@ -740,7 +740,7 @@ bool DNS::ForwardLookup(std::string host) return true; } -bool DNS::ForwardLookupWithFD(std::string host, int &fd) +bool DNS::ForwardLookupWithFD(const std::string &host, int &fd) { if (ServerInstance && ServerInstance->stats) ServerInstance->stats->statsDns++; diff --git a/src/dnsqueue.cpp b/src/dnsqueue.cpp index 6d62b7ede..f14fd8c04 100644 --- a/src/dnsqueue.cpp +++ b/src/dnsqueue.cpp @@ -205,7 +205,7 @@ public: } }; -bool lookup_dns(std::string nick) +bool lookup_dns(const std::string &nick) { /* First attempt to find the nickname */ userrec* u = Find(nick); diff --git a/src/inspircd_io.cpp b/src/inspircd_io.cpp index e8ef405a4..2ca54d24d 100644 --- a/src/inspircd_io.cpp +++ b/src/inspircd_io.cpp @@ -839,7 +839,7 @@ void Start (void) printf("Name concept:\t\t\033[1;32mLord_Zathras\033[0m\n\n"); } -void WritePID(std::string filename) +void WritePID(const std::string &filename) { ofstream outfile(filename.c_str()); if (outfile.is_open()) -- 2.39.5