summaryrefslogtreecommitdiff
path: root/oox/source
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2023-04-26 08:41:23 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-04-28 08:23:04 +0200
commita33922e38b87db5b009986324c6543e90f18a752 (patch)
tree9c0d80bd1c55677efa6e3241fd3d6107c6c58c0c /oox/source
parent2eb3922750b385dcadfd124d7baf686cec40eb5e (diff)
optimise find/insert calls to maps
Instead of doing two lookups, we can just call insert and then update the mapped-to value if the insert actually succeeded. Change-Id: I3df3b98f0debe6bf74c739dd5850e7714d9c2789 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151030 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'oox/source')
-rw-r--r--oox/source/export/chartexport.cxx6
1 files changed, 2 insertions, 4 deletions
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index a2c30f2e8861..94f956428d19 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -3345,10 +3345,8 @@ void ChartExport::_exportAxis(
}
// only export each axis only once non-deleted
- bool bDeleted = maExportedAxis.find(rAxisIdPair.nAxisType) != maExportedAxis.end();
-
- if (!bDeleted)
- maExportedAxis.insert(rAxisIdPair.nAxisType);
+ auto aItInsertedPair = maExportedAxis.insert(rAxisIdPair.nAxisType);
+ bool bDeleted = !aItInsertedPair.second;
pFS->singleElement(FSNS(XML_c, XML_delete), XML_val, !bDeleted && bVisible ? "0" : "1");