From 1094fedfac9d48262400e2a07581bfa36b2a422e Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 29 May 2017 09:16:50 +0200 Subject: 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 Reviewed-by: Noel Grandin --- include/xmloff/fasttokenhandler.hxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include/xmloff') 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 > {}; -- cgit