diff options
author | Liu Hao <ianahao331@gmail.com> | 2022-08-15 00:11:55 +0800 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2022-08-23 10:45:41 +0200 |
commit | 3f284b6f12e3eb047398998b223663b38a9bfec8 (patch) | |
tree | 2ab2974b217af76f37a38fdf34f7e5703d974f09 /scaddins | |
parent | 27892a5e12dada80226f778ab2bd14b1bdaab58a (diff) |
tdf#148251 Use std::swap instead of using temporary values
Change-Id: Ibbc46bfb17d4d27dc40e63c65190b3f3a5f2d9c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138256
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'scaddins')
-rw-r--r-- | scaddins/source/analysis/analysishelper.cxx | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx index 405fdae9e5e6..58f5a4087543 100644 --- a/scaddins/source/analysis/analysishelper.cxx +++ b/scaddins/source/analysis/analysishelper.cxx @@ -345,11 +345,7 @@ sal_Int32 GetDiffDate( sal_Int32 nNullDate, sal_Int32 nStartDate, sal_Int32 nEnd bool bNeg = nStartDate > nEndDate; if( bNeg ) - { - sal_Int32 n = nEndDate; - nEndDate = nStartDate; - nStartDate = n; - } + std::swap( nStartDate, nEndDate ); sal_Int32 nRet; @@ -456,11 +452,7 @@ double GetYearFrac( sal_Int32 nNullDate, sal_Int32 nStartDate, sal_Int32 nEndDat return 0.0; // nothing to do... if( nStartDate > nEndDate ) - { - sal_Int32 n = nEndDate; - nEndDate = nStartDate; - nStartDate = n; - } + std::swap( nStartDate, nEndDate ); sal_Int32 nDate1 = nStartDate + nNullDate; sal_Int32 nDate2 = nEndDate + nNullDate; |