From a33922e38b87db5b009986324c6543e90f18a752 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 26 Apr 2023 08:41:23 +0200 Subject: 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 --- oox/source/export/chartexport.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'oox/source/export') 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"); -- cgit