[Performance] Change to use Pass by reference where valid. (#3163)

* [Performance] Change to use Pass by reference where valid.

* typo
This commit is contained in:
Aeadoin
2023-04-01 22:55:40 -04:00
committed by GitHub
parent 7f7ba2e6c2
commit 1ffdd4cb34
31 changed files with 66 additions and 66 deletions
+9 -9
View File
@@ -348,7 +348,7 @@ static void ProcessMailTo(Client *c, std::string MailMessage) {
}
}
static void ProcessMailTo(Client *c, std::string from, std::string subject, std::string message) {
static void ProcessMailTo(Client *c, const std::string& from, const std::string& subject, const std::string& message) {
}
static void ProcessSetMessageStatus(std::string SetMessageCommand) {
@@ -983,7 +983,7 @@ void Client::SendMailBoxes() {
safe_delete(outapp);
}
Client *Clientlist::FindCharacter(std::string CharacterName) {
Client *Clientlist::FindCharacter(const std::string& CharacterName) {
std::list<Client*>::iterator Iterator;
@@ -1243,7 +1243,7 @@ void Client::LeaveAllChannels(bool send_updated_channel_list, bool command_direc
}
void Client::ProcessChannelList(std::string Input) {
void Client::ProcessChannelList(const std::string& Input) {
if (Input.length() == 0) {
@@ -1521,7 +1521,7 @@ void Client::SendChannelMessageByNumber(std::string Message) {
}
void Client::SendChannelMessage(std::string ChannelName, std::string Message, Client *Sender) {
void Client::SendChannelMessage(const std::string& ChannelName, const std::string& Message, Client *Sender) {
if (!Sender) return;
@@ -1548,7 +1548,7 @@ void Client::SendChannelMessage(std::string ChannelName, std::string Message, Cl
safe_delete(outapp);
}
void Client::ToggleAnnounce(std::string State)
void Client::ToggleAnnounce(const std::string& State)
{
if (State == "")
Announce = !Announce;
@@ -1615,7 +1615,7 @@ void Client::GeneralChannelMessage(const char *Characters) {
}
void Client::GeneralChannelMessage(std::string Message) {
void Client::GeneralChannelMessage(const std::string& Message) {
auto outapp = new EQApplicationPacket(OP_ChannelMessage, Message.length() + 3);
char *PacketBuffer = (char *)outapp->pBuffer;
@@ -2279,7 +2279,7 @@ void Client::SetConnectionType(char c) {
}
}
Client *Clientlist::IsCharacterOnline(std::string CharacterName) {
Client *Clientlist::IsCharacterOnline(const std::string& CharacterName) {
// This method is used to determine if the character we are a sending an email to is connected to the mailserver,
// so we can send them a new email notification.
@@ -2307,7 +2307,7 @@ Client *Clientlist::IsCharacterOnline(std::string CharacterName) {
return nullptr;
}
int Client::GetMailBoxNumber(std::string CharacterName) {
int Client::GetMailBoxNumber(const std::string& CharacterName) {
for (unsigned int i = 0; i < Characters.size(); i++)
if (Characters[i].Name == CharacterName)
@@ -2316,7 +2316,7 @@ int Client::GetMailBoxNumber(std::string CharacterName) {
return -1;
}
void Client::SendNotification(int MailBoxNumber, std::string Subject, std::string From, int MessageID) {
void Client::SendNotification(int MailBoxNumber, const std::string& Subject, const std::string& From, int MessageID) {
char TimeStamp[100];