summaryrefslogtreecommitdiff
path: root/include/xmloff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-05-29 09:16:50 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-05-29 12:57:47 +0200
commit1094fedfac9d48262400e2a07581bfa36b2a422e (patch)
treed25b5741aa2d54825bb41f5473832d2bc8213b62 /include/xmloff
parent649228f932321c2c5784fbf7b0df84712fde55a0 (diff)
getUtf8TokenName can return by const ref
and avoid some reference-counting in a hot path Change-Id: I7f5fd7f8f5f9076eb5f8d60118afa8e3ac8a5e6c Reviewed-on: https://gerrit.libreoffice.org/38129 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/xmloff')
-rw-r--r--include/xmloff/fasttokenhandler.hxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/xmloff/fasttokenhandler.hxx b/include/xmloff/fasttokenhandler.hxx
index ca20d687ad7f..760360711535 100644
--- a/include/xmloff/fasttokenhandler.hxx
+++ b/include/xmloff/fasttokenhandler.hxx
@@ -27,12 +27,12 @@ public:
~TokenMap();
/** Returns the UTF-8 name of the passed token identifier as byte sequence. */
- css::uno::Sequence< sal_Int8 > getUtf8TokenName( sal_Int32 nToken ) const
+ css::uno::Sequence< sal_Int8 > const & getUtf8TokenName( sal_Int32 nToken ) const
{
SAL_WARN_IF(nToken < 0 || nToken >= XML_TOKEN_COUNT, "xmloff", "Wrong nToken parameter");
if( 0 <= nToken && nToken < XML_TOKEN_COUNT )
return maTokenNames[ nToken ];
- return css::uno::Sequence< sal_Int8 >();
+ return EMPTY_BYTE_SEQ;
}
/** Returns the token identifier for the passed UTF-8 token name. */
@@ -52,6 +52,8 @@ private:
static sal_Int32 getTokenPerfectHash( const char *pToken, sal_Int32 nLength );
std::vector< css::uno::Sequence< sal_Int8 > > maTokenNames;
+
+ static const css::uno::Sequence< sal_Int8 > EMPTY_BYTE_SEQ;
};
struct StaticTokenMap : public rtl::Static< TokenMap, StaticTokenMap > {};