[Libreoffice-commits] core.git: 2 commits - basctl/source basic/source tools/inc

Tor Lillqvist tml at iki.fi
Fri Apr 12 13:05:02 PDT 2013


 basctl/source/basicide/iderdll.cxx |    2 +-
 basic/source/classes/sb.cxx        |    9 +++------
 basic/source/classes/sbintern.cxx  |   12 +++++-------
 basic/source/inc/sbintern.hxx      |    1 +
 tools/inc/tools/shl.hxx            |    2 +-
 5 files changed, 11 insertions(+), 15 deletions(-)

New commits:
commit c3d8b06f0058d808aa62c27d06f77e2a25747dd2
Author: Tor Lillqvist <tml at iki.fi>
Date:   Fri Apr 12 23:02:29 2013 +0300

    Get rid of SHL_SBC
    
    GetAppData(SHL_SBC) was used only locally in the sb library so no need for
    it. Just use a static pointer field.
    
    Change-Id: I37c8429b6c9e521a00c52bb622f78bdc4afe345c

diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 6334737..7154e1e 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -25,7 +25,6 @@
 #include <tools/stream.hxx>
 #include <tools/errinf.hxx>
 #include <basic/sbx.hxx>
-#include <tools/shl.hxx>
 #include <tools/rc.hxx>
 #include <vcl/svapp.hxx>
 #include <comphelper/processfactory.hxx>
@@ -964,12 +963,10 @@ StarBASIC::~StarBASIC()
         RemoveFactory( GetSbData()->pFormFac );
         delete GetSbData()->pFormFac; GetSbData()->pFormFac = NULL;
 
-        SbiGlobals** pp = (SbiGlobals**) ::GetAppData( SHL_SBC );
-        SbiGlobals* p = *pp;
-        if( p )
+        if( SbiGlobals::pGlobals )
         {
-            delete p;
-            *pp = 0;
+            delete SbiGlobals::pGlobals;
+            SbiGlobals::pGlobals = 0;
         }
     }
     else if( bDocBasic )
diff --git a/basic/source/classes/sbintern.cxx b/basic/source/classes/sbintern.cxx
index fb3f802..6b3fa49 100644
--- a/basic/source/classes/sbintern.cxx
+++ b/basic/source/classes/sbintern.cxx
@@ -17,8 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <tools/shl.hxx>
-
 #include "sbintern.hxx"
 #include "sbunoobj.hxx"
 #include "token.hxx"
@@ -27,13 +25,13 @@
 #include "codegen.hxx"
 #include <basic/basmgr.hxx>
 
+SbiGlobals* SbiGlobals::pGlobals = 0;
+
 SbiGlobals* GetSbData()
 {
-    SbiGlobals** pp = (SbiGlobals**) ::GetAppData( SHL_SBC );
-    SbiGlobals* p = *pp;
-    if( !p )
-        p = *pp = new SbiGlobals;
-    return p;
+    if( !SbiGlobals::pGlobals )
+        SbiGlobals::pGlobals = new SbiGlobals;
+    return SbiGlobals::pGlobals;
 }
 
 SbiGlobals::SbiGlobals()
diff --git a/basic/source/inc/sbintern.hxx b/basic/source/inc/sbintern.hxx
index 7dfd011..401f7af 100644
--- a/basic/source/inc/sbintern.hxx
+++ b/basic/source/inc/sbintern.hxx
@@ -80,6 +80,7 @@ public:
 
 struct SbiGlobals
 {
+    static SbiGlobals* pGlobals;
     SbiInstance*    pInst;          // all active runtime instances
     SbiFactory*     pSbFac;         // StarBASIC-Factory
     SbUnoFactory*   pUnoFac;        // Factory for Uno-Structs at DIM AS NEW
diff --git a/tools/inc/tools/shl.hxx b/tools/inc/tools/shl.hxx
index c7072bf..945921f 100644
--- a/tools/inc/tools/shl.hxx
+++ b/tools/inc/tools/shl.hxx
@@ -53,7 +53,7 @@
 //25 (SHL_LNKCCH) removed
 //26 (SHL_CHANNEL) removed
 //27 (SHL_SBX) removed
-#define SHL_SBC         28
+//28 (SHL_SBC) removed
 //29 (SHL_SDB) removed
 //30 (SHL_SBA) removed
 //31 (SHL_SBA2) removed
commit 9be3e8e8d52cfb00dff851ee221074b7efce46c1
Author: Tor Lillqvist <tml at iki.fi>
Date:   Fri Apr 12 22:51:28 2013 +0300

    Should initialise Module::mpModule to 0
    
    Change-Id: Ie4648b82a524a7ddcd427d7d2543bc7691eddcf8

diff --git a/basctl/source/basicide/iderdll.cxx b/basctl/source/basicide/iderdll.cxx
index 07351ca..dd20ff6 100644
--- a/basctl/source/basicide/iderdll.cxx
+++ b/basctl/source/basicide/iderdll.cxx
@@ -50,7 +50,7 @@ namespace basctl
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 
-Module* Module::mpModule;
+Module* Module::mpModule = 0;
 
 namespace
 {


More information about the Libreoffice-commits mailing list