sc/inc/compiler.hxx              |    6 ------
 sc/source/core/tool/compiler.cxx |   37 ++++++++++++++-----------------------
 2 files changed, 14 insertions(+), 29 deletions(-)

New commits:
commit 92bede3900e84d4f08efb81757ec95c518c7fa76
Author: Tor Lillqvist <t...@collabora.com>
Date:   Fri Jan 17 16:21:48 2014 +0200

    Avoid some global statics that drag in lots of code in the static linking 
case
    
    When doing static linking, i.e. when building the single executable
    for an iOS app, or the single DSO for an Android app, we list all our
    libraries (which all are static archives) on the linker command
    line. Static initializers in any library always get linked in, so it
    is a good idea to avoid such in the cases where they drag in a large
    amount of code. Which was the case here.
    
    Change-Id: Idef9aec1c10686c86f517ad10cf540a313d9c829

diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index a8757e7..0a1763b 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -289,12 +289,6 @@ private:
     static CharClass            *pCharClassEnglish;                      // 
character classification for en_US locale
     static const Convention     *pConventions[ 
formula::FormulaGrammar::CONV_LAST ];
 
-    static const Convention * const pConvOOO_A1;
-    static const Convention * const pConvOOO_A1_ODF;
-    static const Convention * const pConvXL_A1;
-    static const Convention * const pConvXL_R1C1;
-    static const Convention * const pConvXL_OOX;
-
     static struct AddInMap
     {
         const char* pODFF;
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 7b9bced..3730d24 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -272,7 +272,7 @@ void ScCompiler::SetGrammarAndRefConvention(
         if (pDoc)
             SetRefConvention( pDoc->GetAddressConvention());
         else
-            SetRefConvention( pConvOOO_A1);
+            SetRefConvention( GetRefConvention( FormulaGrammar::CONV_OOO ) );
     }
     else
         SetRefConvention( eConv );
@@ -922,9 +922,6 @@ struct ConventionOOO_A1 : public Convention_A1
     }
 };
 
-static const ConventionOOO_A1 ConvOOO_A1;
-const ScCompiler::Convention * const ScCompiler::pConvOOO_A1 = &ConvOOO_A1;
-
 struct ConventionOOO_A1_ODF : public ConventionOOO_A1
 {
     ConventionOOO_A1_ODF() : ConventionOOO_A1 (FormulaGrammar::CONV_ODF) { }
@@ -983,9 +980,6 @@ struct ConventionOOO_A1_ODF : public ConventionOOO_A1
     }
 };
 
-static const ConventionOOO_A1_ODF ConvOOO_A1_ODF;
-const ScCompiler::Convention * const ScCompiler::pConvOOO_A1_ODF = 
&ConvOOO_A1_ODF;
-
 struct ConventionXL
 {
     static void GetTab(
@@ -1307,17 +1301,11 @@ struct ConventionXL_A1 : public Convention_A1, public 
ConventionXL
     }
 };
 
-static const ConventionXL_A1 ConvXL_A1;
-const ScCompiler::Convention * const ScCompiler::pConvXL_A1 = &ConvXL_A1;
-
 struct ConventionXL_OOX : public ConventionXL_A1
 {
     ConventionXL_OOX() : ConventionXL_A1( FormulaGrammar::CONV_XL_OOX ) { }
 };
 
-static const ConventionXL_OOX ConvXL_OOX;
-const ScCompiler::Convention * const ScCompiler::pConvXL_OOX = &ConvXL_OOX;
-
 static void
 r1c1_add_col( OUStringBuffer &rBuf, const ScSingleRefData& rRef, const 
ScAddress& rAbsRef )
 {
@@ -1526,9 +1514,6 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, 
public ConventionXL
     }
 };
 
-static const ConventionXL_R1C1 ConvXL_R1C1;
-const ScCompiler::Convention * const ScCompiler::pConvXL_R1C1 = &ConvXL_R1C1;
-
 ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& 
rPos,ScTokenArray& rArr)
         : FormulaCompiler(rArr),
         pDoc( pDocument ),
@@ -1537,7 +1522,7 @@ ScCompiler::ScCompiler( ScDocument* pDocument, const 
ScAddress& rPos,ScTokenArra
         pCharClass( ScGlobal::pCharClass ),
         mnPredetectedReference(0),
         mnRangeOpPosInSymbol(-1),
-        pConv( pConvOOO_A1 ),
+        pConv( GetRefConvention( FormulaGrammar::CONV_OOO ) ),
         meExtendedErrorDetection( EXTENDED_ERROR_DETECTION_NONE ),
         mbCloseBrackets( true ),
         mbRewind( false )
@@ -1563,7 +1548,7 @@ ScCompiler::ScCompiler( ScDocument* pDocument, const 
ScAddress& rPos)
         pCharClass( ScGlobal::pCharClass ),
         mnPredetectedReference(0),
         mnRangeOpPosInSymbol(-1),
-        pConv( pConvOOO_A1 ),
+        pConv( GetRefConvention( FormulaGrammar::CONV_OOO ) ),
         meExtendedErrorDetection( EXTENDED_ERROR_DETECTION_NONE ),
         mbCloseBrackets( true ),
         mbRewind( false )
@@ -1646,18 +1631,24 @@ void ScCompiler::SetRefConvention( 
FormulaGrammar::AddressConvention eConv )
 
 const ScCompiler::Convention* ScCompiler::GetRefConvention( 
FormulaGrammar::AddressConvention eConv )
 {
+    static const ConventionOOO_A1 ConvOOO_A1;
+    static const ConventionOOO_A1_ODF ConvOOO_A1_ODF;
+    static const ConventionXL_A1 ConvXL_A1;
+    static const ConventionXL_R1C1 ConvXL_R1C1;
+    static const ConventionXL_OOX ConvXL_OOX;
+
     switch (eConv)
     {
         case FormulaGrammar::CONV_OOO:
-            return pConvOOO_A1;
+            return &ConvOOO_A1;
         case FormulaGrammar::CONV_ODF:
-            return pConvOOO_A1_ODF;
+            return &ConvOOO_A1_ODF;
         case FormulaGrammar::CONV_XL_A1:
-            return pConvXL_A1;
+            return &ConvXL_A1;
         case FormulaGrammar::CONV_XL_R1C1:
-            return pConvXL_R1C1;
+            return &ConvXL_R1C1;
         case FormulaGrammar::CONV_XL_OOX:
-            return pConvXL_OOX;
+            return &ConvXL_OOX;
         case FormulaGrammar::CONV_UNSPECIFIED:
         default:
             ;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to