mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
[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:
+1
-1
@@ -125,7 +125,7 @@ public:
|
||||
StackWalker::OnOutput(szText);
|
||||
}
|
||||
|
||||
const std::vector<std::string>& const GetLines() { return _lines; }
|
||||
const std::vector<std::string>& GetLines() { return _lines; }
|
||||
private:
|
||||
std::vector<std::string> _lines;
|
||||
};
|
||||
|
||||
+1
-1
@@ -999,7 +999,7 @@ bool Database::GetVariable(std::string varname, std::string &varvalue)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Database::SetVariable(const std::string varname, const std::string &varvalue)
|
||||
bool Database::SetVariable(const std::string& varname, const std::string &varvalue)
|
||||
{
|
||||
std::string escaped_name = Strings::Escape(varname);
|
||||
std::string escaped_value = Strings::Escape(varvalue);
|
||||
|
||||
+1
-1
@@ -235,7 +235,7 @@ public:
|
||||
/* Database Variables */
|
||||
|
||||
bool GetVariable(std::string varname, std::string &varvalue);
|
||||
bool SetVariable(const std::string varname, const std::string &varvalue);
|
||||
bool SetVariable(const std::string& varname, const std::string &varvalue);
|
||||
bool LoadVariables();
|
||||
|
||||
/* General Queries */
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ void DBcore::ping()
|
||||
m_mutex->unlock();
|
||||
}
|
||||
|
||||
MySQLRequestResult DBcore::QueryDatabase(std::string query, bool retryOnFailureOnce)
|
||||
MySQLRequestResult DBcore::QueryDatabase(const std::string& query, bool retryOnFailureOnce)
|
||||
{
|
||||
auto r = QueryDatabase(query.c_str(), query.length(), retryOnFailureOnce);
|
||||
return r;
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ public:
|
||||
~DBcore();
|
||||
eStatus GetStatus() { return pStatus; }
|
||||
MySQLRequestResult QueryDatabase(const char *query, uint32 querylen, bool retryOnFailureOnce = true);
|
||||
MySQLRequestResult QueryDatabase(std::string query, bool retryOnFailureOnce = true);
|
||||
MySQLRequestResult QueryDatabase(const std::string& query, bool retryOnFailureOnce = true);
|
||||
void TransactionBegin();
|
||||
void TransactionCommit();
|
||||
void TransactionRollback();
|
||||
|
||||
+1
-1
@@ -129,7 +129,7 @@ namespace EQ
|
||||
|
||||
LookupEntry(const LookupEntry *lookup_entry) { }
|
||||
LookupEntry(
|
||||
InventoryTypeSize_Struct InventoryTypeSize,
|
||||
const InventoryTypeSize_Struct& InventoryTypeSize,
|
||||
uint64 EquipmentBitmask,
|
||||
uint64 GeneralBitmask,
|
||||
uint64 CursorBitmask,
|
||||
|
||||
@@ -64,7 +64,7 @@ void ProcLauncher::Process() {
|
||||
if(GetExitCodeProcess(cur->second->proc_info.hProcess, &res)) {
|
||||
//got exit code, see if its still running...
|
||||
if(res == STILL_ACTIVE) {
|
||||
cur++;
|
||||
++cur;
|
||||
continue;
|
||||
}
|
||||
//else, it died, handle properly
|
||||
@@ -76,7 +76,7 @@ void ProcLauncher::Process() {
|
||||
|
||||
//if we get here, the current process died.
|
||||
tmp = cur;
|
||||
tmp++;
|
||||
++tmp;
|
||||
ProcessTerminated(cur);
|
||||
cur = tmp;
|
||||
}
|
||||
@@ -174,7 +174,7 @@ ProcLauncher::ProcRef ProcLauncher::Launch(Spec *&to_launch) {
|
||||
std::vector<std::string>::iterator cur, end;
|
||||
cur = it->args.begin();
|
||||
end = it->args.end();
|
||||
for(; cur != end; cur++) {
|
||||
for(; cur != end; ++cur) {
|
||||
args += " ";
|
||||
args += *cur;
|
||||
}
|
||||
@@ -306,7 +306,7 @@ void ProcLauncher::TerminateAll(bool final) {
|
||||
std::map<ProcRef, Spec *>::iterator cur, end;
|
||||
cur = m_running.begin();
|
||||
end = m_running.end();
|
||||
for(; cur != end; cur++) {
|
||||
for(; cur != end; ++cur) {
|
||||
Terminate(cur->first, true);
|
||||
}
|
||||
} else {
|
||||
@@ -317,7 +317,7 @@ void ProcLauncher::TerminateAll(bool final) {
|
||||
std::map<ProcRef, Spec *>::iterator cur, end;
|
||||
cur = running.begin();
|
||||
end = running.end();
|
||||
for(; cur != end; cur++) {
|
||||
for(; cur != end; ++cur) {
|
||||
Terminate(cur->first, true);
|
||||
safe_delete(cur->second);
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ bool EQ::ProfanityManager::clear_database_entries(DBcore *db) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EQ::ProfanityManager::check_for_existing_entry(std::string profanity) {
|
||||
bool EQ::ProfanityManager::check_for_existing_entry(const std::string& profanity) {
|
||||
if (profanity.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace EQ
|
||||
private:
|
||||
static bool load_database_entries(DBcore *db);
|
||||
static bool clear_database_entries(DBcore *db);
|
||||
static bool check_for_existing_entry(std::string profanity);
|
||||
static bool check_for_existing_entry(const std::string& profanity);
|
||||
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -294,7 +294,7 @@ void EQ::SayLinkEngine::generate_text()
|
||||
m_LinkText = "null";
|
||||
}
|
||||
|
||||
std::string EQ::SayLinkEngine::GenerateQuestSaylink(std::string saylink_text, bool silent, std::string link_name)
|
||||
std::string EQ::SayLinkEngine::GenerateQuestSaylink(const std::string& saylink_text, bool silent, const std::string& link_name)
|
||||
{
|
||||
uint32 saylink_id = 0;
|
||||
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ namespace EQ
|
||||
const std::string& LinkBody() { return m_LinkBody; } // contains string format: '<LinkBody>'
|
||||
const std::string& LinkText() { return m_LinkText; } // contains string format: '<LinkText>'
|
||||
|
||||
static std::string GenerateQuestSaylink(std::string saylink_text, bool silent, std::string link_name);
|
||||
static std::string GenerateQuestSaylink(const std::string& saylink_text, bool silent, const std::string& link_name);
|
||||
|
||||
void Reset();
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ ZoneRepository::Zone *ZoneStore::GetZone(const char *in_zone_name)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ZoneRepository::Zone *ZoneStore::GetZone(std::string in_zone_name)
|
||||
ZoneRepository::Zone *ZoneStore::GetZone(const std::string& in_zone_name)
|
||||
{
|
||||
for (auto &z: m_zones) {
|
||||
if (z.short_name == in_zone_name) {
|
||||
|
||||
+2
-2
@@ -35,7 +35,7 @@ public:
|
||||
|
||||
ZoneRepository::Zone *GetZone(uint32 zone_id, int version = 0);
|
||||
ZoneRepository::Zone *GetZone(const char *in_zone_name);
|
||||
ZoneRepository::Zone *GetZone(std::string in_zone_name);
|
||||
ZoneRepository::Zone *GetZone(const std::string& in_zone_name);
|
||||
uint32 GetZoneID(const char *in_zone_name);
|
||||
uint32 GetZoneID(std::string zone_name);
|
||||
std::string GetZoneName(uint32 zone_id);
|
||||
@@ -53,7 +53,7 @@ extern ZoneStore zone_store;
|
||||
* Global helpers
|
||||
*/
|
||||
inline uint32 ZoneID(const char *in_zone_name) { return zone_store.GetZoneID(in_zone_name); }
|
||||
inline uint32 ZoneID(std::string zone_name) { return zone_store.GetZoneID(zone_name); }
|
||||
inline uint32 ZoneID(const std::string& zone_name) { return zone_store.GetZoneID(zone_name); }
|
||||
inline const char *ZoneName(uint32 zone_id, bool error_unknown = false)
|
||||
{
|
||||
return zone_store.GetZoneName(
|
||||
|
||||
Reference in New Issue
Block a user