[Libreoffice-commits] .: Branch 'feature/calc-matrix-rework' - sc/inc sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Thu Dec 16 23:21:04 PST 2010


 sc/inc/scmatrix.hxx              |   15 ++++-----------
 sc/source/core/tool/interpr5.cxx |    5 ++---
 2 files changed, 6 insertions(+), 14 deletions(-)

New commits:
commit f390aab2bba4ebd1144ee8cb00155b4bccb2a5ae
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Fri Dec 17 02:20:46 2010 -0500

    Removed ScMatrix::Delete().

diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx
index 5f9b9c9..1407f56 100644
--- a/sc/inc/scmatrix.hxx
+++ b/sc/inc/scmatrix.hxx
@@ -225,22 +225,15 @@ public:
         MUST be at least of the size of the original matrix. */
     ScMatrix* CloneAndExtend( SCSIZE nNewCols, SCSIZE nNewRows, DensityType eType) const;
 
-    inline  void    IncRef() const
+    inline void IncRef() const
     {
         ++nRefCnt;
     }
-    inline  void    DecRef() const
+    inline void DecRef() const
     {
-        if ( nRefCnt > 0 )
-            if ( --nRefCnt == 0 )
-                delete this;
-    }
-    inline  void    Delete()
-    {
-        if ( nRefCnt == 0 )
+        --nRefCnt;
+        if (nRefCnt == 0)
             delete this;
-        else
-            --nRefCnt;
     }
 
     DensityType GetDensityType() const;
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index 780bdc0..f398985 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -333,7 +333,7 @@ void ScInterpreter:: ScLCM()
 ScMatrixRef ScInterpreter::GetNewMat(SCSIZE nC, SCSIZE nR)
 {
     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetNewMat" );
-    ScMatrix* pMat = new ScMatrix( nC, nR);
+    ScMatrixRef pMat = new ScMatrix( nC, nR);
     pMat->SetErrorInterpreter( this);
     // A temporary matrix is mutable and ScMatrix::CloneIfConst() returns the 
     // very matrix.
@@ -343,8 +343,7 @@ ScMatrixRef ScInterpreter::GetNewMat(SCSIZE nC, SCSIZE nR)
     if ( nCols != nC || nRows != nR )
     {   // arbitray limit of elements exceeded
         SetError( errStackOverflow);
-        pMat->Delete();
-        pMat = NULL;
+        pMat.reset();
     }
     return pMat;
 }


More information about the Libreoffice-commits mailing list