diff options
| author | Léo Lam <leo@leolam.fr> | 2021-01-05 22:28:50 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-05 16:28:50 -0500 |
| commit | 978dcbcb5a9cb68d558de132c0661f6141887e5d (patch) | |
| tree | a5979f922825b85864e08cef6c79f742c1b4cd91 /ZAPD/ZResource.cpp | |
| parent | 4ea37af45af670e65547a35c49a2288ef2a63245 (diff) | |
Avoid unnecessary copies (#46)
Pass some parameters by reference to avoid unnecessary copies.
When the parameter is intended to be copied into a member variable,
pass it by value and move it into the member instead.
This doesn't fix every occurrence of the issue but this diff is already
getting big so let's stop here for the moment.
Diffstat (limited to 'ZAPD/ZResource.cpp')
| -rw-r--r-- | ZAPD/ZResource.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ZAPD/ZResource.cpp b/ZAPD/ZResource.cpp index 489724e..efacafc 100644 --- a/ZAPD/ZResource.cpp +++ b/ZAPD/ZResource.cpp @@ -25,7 +25,7 @@ void ZResource::ParseXML(tinyxml2::XMLElement* reader) outName = name; } -void ZResource::Save(string outFolder) +void ZResource::Save(const std::string& outFolder) { } @@ -46,7 +46,7 @@ std::string ZResource::GetOutName() void ZResource::SetName(string nName) { - name = nName; + name = std::move(nName); } bool ZResource::IsExternalResource() @@ -84,12 +84,12 @@ void ZResource::SetRawDataIndex(int value) rawDataIndex = value; } -string ZResource::GetSourceOutputCode(std::string prefix) +string ZResource::GetSourceOutputCode(const std::string& prefix) { return ""; } -string ZResource::GetSourceOutputHeader(std::string prefix) +string ZResource::GetSourceOutputHeader(const std::string& prefix) { return ""; } |
