From 86a32589e90ee983159fb5b2c6a594428ab7d422 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 6 Mar 2014 15:29:08 +0200 Subject: Find places where OUString and OString are passed by value. It's not very efficient, because we generally end up copying it twice - once into the parameter and again into the destination OUString. So I create a clang plugin that finds such places and generates a warning so that we can convert them to pass-by-reference. Change-Id: I5341a6ea9e3190f4b4c05c42c85595e3dcd83361 --- unoxml/source/events/eventdispatcher.cxx | 6 +++--- unoxml/source/events/eventdispatcher.hxx | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'unoxml') diff --git a/unoxml/source/events/eventdispatcher.cxx b/unoxml/source/events/eventdispatcher.cxx index f159e472b0f9..1b155aa67c2d 100644 --- a/unoxml/source/events/eventdispatcher.cxx +++ b/unoxml/source/events/eventdispatcher.cxx @@ -29,7 +29,7 @@ namespace DOM { namespace events { - void CEventDispatcher::addListener(xmlNodePtr pNode, OUString aType, const Reference& aListener, sal_Bool bCapture) + void CEventDispatcher::addListener(xmlNodePtr pNode, const OUString& aType, const Reference& aListener, sal_Bool bCapture) { TypeListenerMap *const pTMap = (bCapture) ? (& m_CaptureListeners) : (& m_TargetListeners); @@ -48,7 +48,7 @@ namespace DOM { namespace events { pMap->insert(ListenerMap::value_type(pNode, aListener)); } - void CEventDispatcher::removeListener(xmlNodePtr pNode, OUString aType, const Reference& aListener, sal_Bool bCapture) + void CEventDispatcher::removeListener(xmlNodePtr pNode, const OUString& aType, const Reference& aListener, sal_Bool bCapture) { TypeListenerMap *const pTMap = (bCapture) ? (& m_CaptureListeners) : (& m_TargetListeners); @@ -87,7 +87,7 @@ namespace DOM { namespace events { void CEventDispatcher::callListeners( TypeListenerMap const& rTMap, xmlNodePtr const pNode, - OUString aType, Reference< XEvent > const& xEvent) + const OUString& aType, Reference< XEvent > const& xEvent) { // get the multimap for the specified type TypeListenerMap::const_iterator tIter = rTMap.find(aType); diff --git a/unoxml/source/events/eventdispatcher.hxx b/unoxml/source/events/eventdispatcher.hxx index b6259f481a20..b5541bf0f8c9 100644 --- a/unoxml/source/events/eventdispatcher.hxx +++ b/unoxml/source/events/eventdispatcher.hxx @@ -57,20 +57,20 @@ private: public: void addListener( xmlNodePtr pNode, - OUString aType, + const OUString& aType, const Reference& aListener, sal_Bool bCapture); void removeListener( xmlNodePtr pNode, - OUString aType, + const OUString& aType, const Reference& aListener, sal_Bool bCapture); static void callListeners( TypeListenerMap const& rTMap, xmlNodePtr const pNode, - OUString aType, + const OUString& aType, const Reference< XEvent >& xEvent); bool dispatchEvent( -- cgit v1.2.3