mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-23 12:48:27 +00:00
# housekeeping
replaced all (*) CStr / CStrW by-value params with const reference. hoo boy. please always perform this optimization (actually standard idiom) when writing the code - it takes little work, tells the next guy that the string won't be modified, and makes a large performance difference. (* where possible.. a few require other changes and will follow later) This was SVN commit r4151.
This commit is contained in:
@@ -11,16 +11,16 @@ CStrW ToNetString(const uint &val)
|
||||
}
|
||||
|
||||
template <>
|
||||
void SetFromNetString(uint &val, CStrW string)
|
||||
void SetFromNetString(uint &val, const CStrW& string)
|
||||
{
|
||||
val=string.ToUInt();
|
||||
}
|
||||
|
||||
template <>
|
||||
CStrW ToNetString(const CStrW &data)
|
||||
CStrW ToNetString(const CStrW& data)
|
||||
{ return data; }
|
||||
|
||||
template <> void SetFromNetString(CStrW &data, CStrW string)
|
||||
template <> void SetFromNetString(CStrW& data, const CStrW& string)
|
||||
{ data=string; }
|
||||
|
||||
template <>
|
||||
@@ -34,7 +34,7 @@ CStrW ToNetString(const SColour &data)
|
||||
}
|
||||
|
||||
template <>
|
||||
void SetFromNetString(SColour &data, CStrW wstring)
|
||||
void SetFromNetString(SColour &data, const CStrW& wstring)
|
||||
{
|
||||
CParser &parser(CParserCache::Get("$value_$value_$value_$value"));
|
||||
CParserLine line;
|
||||
@@ -67,7 +67,7 @@ void CSynchedJSObjectBase::IterateSynchedProperties(IterateCB *cb, void *userdat
|
||||
}
|
||||
}
|
||||
|
||||
ISynchedJSProperty *CSynchedJSObjectBase::GetSynchedProperty(CStrW name)
|
||||
ISynchedJSProperty *CSynchedJSObjectBase::GetSynchedProperty(const CStrW& name)
|
||||
{
|
||||
SynchedPropertyIterator prop=m_SynchedProperties.find(name);
|
||||
if (prop != m_SynchedProperties.end())
|
||||
|
||||
Reference in New Issue
Block a user