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
This commit is contained in:
Tor Lillqvist
2013-04-12 23:02:29 +03:00
parent 9be3e8e8d5
commit c3d8b06f00
4 changed files with 10 additions and 14 deletions

View File

@@ -25,7 +25,6 @@
#include <tools/stream.hxx> #include <tools/stream.hxx>
#include <tools/errinf.hxx> #include <tools/errinf.hxx>
#include <basic/sbx.hxx> #include <basic/sbx.hxx>
#include <tools/shl.hxx>
#include <tools/rc.hxx> #include <tools/rc.hxx>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
@@ -964,12 +963,10 @@ StarBASIC::~StarBASIC()
RemoveFactory( GetSbData()->pFormFac ); RemoveFactory( GetSbData()->pFormFac );
delete GetSbData()->pFormFac; GetSbData()->pFormFac = NULL; delete GetSbData()->pFormFac; GetSbData()->pFormFac = NULL;
SbiGlobals** pp = (SbiGlobals**) ::GetAppData( SHL_SBC ); if( SbiGlobals::pGlobals )
SbiGlobals* p = *pp;
if( p )
{ {
delete p; delete SbiGlobals::pGlobals;
*pp = 0; SbiGlobals::pGlobals = 0;
} }
} }
else if( bDocBasic ) else if( bDocBasic )

View File

@@ -17,8 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include <tools/shl.hxx>
#include "sbintern.hxx" #include "sbintern.hxx"
#include "sbunoobj.hxx" #include "sbunoobj.hxx"
#include "token.hxx" #include "token.hxx"
@@ -27,13 +25,13 @@
#include "codegen.hxx" #include "codegen.hxx"
#include <basic/basmgr.hxx> #include <basic/basmgr.hxx>
SbiGlobals* SbiGlobals::pGlobals = 0;
SbiGlobals* GetSbData() SbiGlobals* GetSbData()
{ {
SbiGlobals** pp = (SbiGlobals**) ::GetAppData( SHL_SBC ); if( !SbiGlobals::pGlobals )
SbiGlobals* p = *pp; SbiGlobals::pGlobals = new SbiGlobals;
if( !p ) return SbiGlobals::pGlobals;
p = *pp = new SbiGlobals;
return p;
} }
SbiGlobals::SbiGlobals() SbiGlobals::SbiGlobals()

View File

@@ -80,6 +80,7 @@ public:
struct SbiGlobals struct SbiGlobals
{ {
static SbiGlobals* pGlobals;
SbiInstance* pInst; // all active runtime instances SbiInstance* pInst; // all active runtime instances
SbiFactory* pSbFac; // StarBASIC-Factory SbiFactory* pSbFac; // StarBASIC-Factory
SbUnoFactory* pUnoFac; // Factory for Uno-Structs at DIM AS NEW SbUnoFactory* pUnoFac; // Factory for Uno-Structs at DIM AS NEW

View File

@@ -53,7 +53,7 @@
//25 (SHL_LNKCCH) removed //25 (SHL_LNKCCH) removed
//26 (SHL_CHANNEL) removed //26 (SHL_CHANNEL) removed
//27 (SHL_SBX) removed //27 (SHL_SBX) removed
#define SHL_SBC 28 //28 (SHL_SBC) removed
//29 (SHL_SDB) removed //29 (SHL_SDB) removed
//30 (SHL_SBA) removed //30 (SHL_SBA) removed
//31 (SHL_SBA2) removed //31 (SHL_SBA2) removed