summaryrefslogtreecommitdiff
path: root/sw/inc/pam.hxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-07-25 13:32:18 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-07-26 07:54:25 +0200
commit9acc54e65476e405bd8d9e4bca135be968448d3c (patch)
treee149f393161c5cf225e0dd3fa275118820d99c04 /sw/inc/pam.hxx
parent3caade9b4734245471347c7eb20090607d70f7b7 (diff)
elide some temporaries when constructing SwPosition
because the resulting pointer manipulation is not free, the temporary has to be attached to a linked list and then immediately de-linked Change-Id: I10594026aa388064abc652b91aff024deeb5ca54 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137410 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/inc/pam.hxx')
-rw-r--r--sw/inc/pam.hxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx
index fad762cab0e8..68282d98ca4e 100644
--- a/sw/inc/pam.hxx
+++ b/sw/inc/pam.hxx
@@ -39,9 +39,13 @@ struct SAL_WARN_UNUSED SW_DLLPUBLIC SwPosition
SwContentIndex nContent;
SwPosition( const SwNodeIndex &rNode, const SwContentIndex &rContent );
- explicit SwPosition( const SwNodeIndex &rNode );
- explicit SwPosition( const SwNode& rNode );
- explicit SwPosition( const SwContentNode& rNode, const sal_Int32 nOffset = 0 );
+ explicit SwPosition( SwNodes& rNodes, SwNodeOffset nIndex = SwNodeOffset(0) );
+ explicit SwPosition( const SwNodeIndex &rNode, SwNodeOffset nDiff = SwNodeOffset(0) );
+ explicit SwPosition( const SwNode& rNode, SwNodeOffset nDiff = SwNodeOffset(0) );
+ explicit SwPosition( const SwContentNode& rNode, const sal_Int32 nContentOffset = 0 );
+
+ // callers should be using one of the other constructors to avoid creating a temporary
+ SwPosition( SwNodeIndex && ) = delete;
/**
Returns the document this position is in.
@@ -181,7 +185,7 @@ public:
{
/** clear the mark position; this helps if mark's SwContentIndex is
registered at some node, and that node is then deleted */
- *m_pMark = SwPosition( SwNodeIndex( GetNode().GetNodes() ) );
+ *m_pMark = SwPosition( GetNode().GetNodes() );
m_pMark = m_pPoint;
}
}