summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-09-28 09:24:13 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-09-28 11:28:39 +0200
commita1d6ec66ce4b8dd84f0962f9b749b831cbb05baf (patch)
tree704cb2c1bb96bda2989668892f9e863ead2a4dca
parentb47733e5f0a16f3fc1bdaad5c3ec171f2fc35d02 (diff)
elide strlen cost in FastAttributeIter::toDouble
by inlining the underlying code to rtl_str_toDouble Change-Id: If379bf40472455be93ca4da6ece25a126bed0b73 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140691 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--include/sax/fastattribs.hxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index ef7e97884735..22512bd5a929 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -25,6 +25,7 @@
#include <com/sun/star/util/XCloneable.hpp>
#include <cppuhelper/implbase.hxx>
+#include <rtl/math.h>
#include <sax/saxdllapi.h>
#include <string_view>
@@ -172,7 +173,9 @@ public:
double toDouble() const
{
assert(mnIdx < mrList.maAttributeTokens.size());
- return rtl_str_toDouble(mrList.getFastAttributeValue(mnIdx));
+ const char* pStr = mrList.getFastAttributeValue(mnIdx);
+ sal_Int32 nLen = mrList.AttributeValueLength(mnIdx);
+ return rtl_math_stringToDouble(pStr, pStr + nLen, '.', 0, nullptr, nullptr);
}
bool toBoolean() const
{