dbertoni    2002/09/04 18:11:32

  Modified:    c/src/PlatformSupport DOMStringHelper.cpp
                        DOMStringHelper.hpp FormatterListener.cpp
                        FormatterListener.hpp PlatformSupportInit.cpp
  Log:
  Reduce start-up dynamic memory utilization.
  
  Revision  Changes    Path
  1.74      +62 -41    xml-xalan/c/src/PlatformSupport/DOMStringHelper.cpp
  
  Index: DOMStringHelper.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/DOMStringHelper.cpp,v
  retrieving revision 1.73
  retrieving revision 1.74
  diff -u -r1.73 -r1.74
  --- DOMStringHelper.cpp       31 Jul 2002 04:39:07 -0000      1.73
  +++ DOMStringHelper.cpp       5 Sep 2002 01:11:31 -0000       1.74
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -121,47 +121,53 @@
   
   
   
  -static XalanDOMString        theNaNString;
  -
  -static XalanDOMString        theNegativeInfinityString;
  -
  -static XalanDOMString        thePositiveInfinityString;
  -
  -static XalanDOMString        theNegativeZeroString;
  -
  -static XalanDOMString        thePositiveZeroString;
  -
  -
  +static XalanDOMChar          theNaNString[] =
  +{
  +     XalanUnicode::charLetter_N,
  +     XalanUnicode::charLetter_a,
  +     XalanUnicode::charLetter_N,
  +     0
  +};
   
  -/**
  - * Initialize static data.  Must be called before any
  - * other functions are called.  See PlatformSupportInit.
  - */
  -XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(void)
  -DOMStringHelperInitialize()
  +static const XalanDOMChar    theNegativeInfinityString[] =
   {
  -     theNaNString = XALAN_STATIC_UCODE_STRING("NaN");
  -     theNegativeInfinityString = XALAN_STATIC_UCODE_STRING("-Infinity");
  -     thePositiveInfinityString = XALAN_STATIC_UCODE_STRING("Infinity");
  -     theNegativeZeroString = XALAN_STATIC_UCODE_STRING("-0");
  -     thePositiveZeroString = XALAN_STATIC_UCODE_STRING("0");
  -}
  +     XalanUnicode::charHyphenMinus,
  +     XalanUnicode::charLetter_I,
  +     XalanUnicode::charLetter_n,
  +     XalanUnicode::charLetter_f,
  +     XalanUnicode::charLetter_i,
  +     XalanUnicode::charLetter_n,
  +     XalanUnicode::charLetter_i,
  +     XalanUnicode::charLetter_t,
  +     XalanUnicode::charLetter_y,
  +     0
  +};
   
  +static const XalanDOMChar    thePositiveInfinityString[] =
  +{
  +     XalanUnicode::charLetter_I,
  +     XalanUnicode::charLetter_n,
  +     XalanUnicode::charLetter_f,
  +     XalanUnicode::charLetter_i,
  +     XalanUnicode::charLetter_n,
  +     XalanUnicode::charLetter_i,
  +     XalanUnicode::charLetter_t,
  +     XalanUnicode::charLetter_y,
  +     0
  +};
   
  +static const XalanDOMChar    theNegativeZeroString[] =
  +{
  +     XalanUnicode::charHyphenMinus,
  +     XalanUnicode::charDigit_0,
  +     0
  +};
   
  -/**
  - * Destroy static data.  After thus function is called,
  - * no other functions can be called.  See PlatformSupportInit.
  - */
  -XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(void)
  -DOMStringHelperTerminate()
  +static const XalanDOMChar    thePositiveZeroString[] =
   {
  -     releaseMemory(theNaNString);
  -     releaseMemory(theNegativeInfinityString);
  -     releaseMemory(thePositiveInfinityString);
  -     releaseMemory(theNegativeZeroString);
  -     releaseMemory(thePositiveZeroString);
  -}
  +     XalanUnicode::charDigit_0,
  +     0
  +};
   
   
   
  @@ -1460,23 +1466,38 @@
   {
        if (DoubleSupport::isNaN(theDouble) == true)
        {
  -             append(theResult, theNaNString);
  +             append(
  +                     theResult,
  +                     theNaNString,
  +                     sizeof(theNaNString) / sizeof(theNaNString[0]) - 1);
        }
        else if (DoubleSupport::isPositiveInfinity(theDouble) == true)
        {
  -             append(theResult, thePositiveInfinityString);
  +             append(
  +                     theResult,
  +                     thePositiveInfinityString,
  +                     sizeof(thePositiveInfinityString) / 
sizeof(thePositiveInfinityString[0]) - 1);
        }
        else if (DoubleSupport::isNegativeInfinity(theDouble) == true)
        {
  -             append(theResult, theNegativeInfinityString);
  +             append(
  +                     theResult,
  +                     theNegativeInfinityString,
  +                     sizeof(theNegativeInfinityString) / 
sizeof(theNegativeInfinityString[0]) - 1);
        }
        else if (DoubleSupport::isPositiveZero(theDouble) == true)
        {
  -             append(theResult, thePositiveZeroString);
  +             append(
  +                     theResult,
  +                     thePositiveZeroString,
  +                     sizeof(thePositiveZeroString) / 
sizeof(thePositiveZeroString[0]) - 1);
        }
        else if (DoubleSupport::isNegativeZero(theDouble) == true)
        {
  -             append(theResult, theNegativeZeroString);
  +             append(
  +                     theResult,
  +                     theNegativeZeroString,
  +                     sizeof(theNegativeZeroString) / 
sizeof(theNegativeZeroString[0]) - 1);
        }
        else if (long(theDouble) == theDouble)
        {
  
  
  
  1.58      +0 -18     xml-xalan/c/src/PlatformSupport/DOMStringHelper.hpp
  
  Index: DOMStringHelper.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/DOMStringHelper.hpp,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- DOMStringHelper.hpp       22 Jul 2002 22:28:55 -0000      1.57
  +++ DOMStringHelper.hpp       5 Sep 2002 01:11:31 -0000       1.58
  @@ -134,24 +134,6 @@
   
   
   /**
  - * Initialize static data.  Must be called before any
  - * other functions are called.  See PlatformSupportInit.
  - */
  -XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(void)
  -DOMStringHelperInitialize();
  -
  -
  -
  -/**
  - * Destroy static data.  After thus function is called,
  - * no other functions can be called.  See PlatformSupportInit.
  - */
  -XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(void)
  -DOMStringHelperTerminate();
  -
  -
  -
  -/**
    * Get the underlying representation of the target XalanDOMString as a
    * null-terminated string
    * 
  
  
  
  1.4       +16 -28    xml-xalan/c/src/PlatformSupport/FormatterListener.cpp
  
  Index: FormatterListener.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/FormatterListener.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FormatterListener.cpp     8 Aug 2001 15:51:36 -0000       1.3
  +++ FormatterListener.cpp     5 Sep 2002 01:11:31 -0000       1.4
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -88,32 +88,20 @@
   
   
   
  -static XalanDOMString        s_xsltNextIsRawString;
  -
  -static XalanDOMString        s_formatterListenerString;
  -
  -
  -
  -const XalanDOMString&        FormatterListener::s_xsltNextIsRawString = 
::s_xsltNextIsRawString;
  -
  -const XalanDOMString&        FormatterListener::s_formatterListenerString = 
::s_formatterListenerString;
  -
  -
  -
  -void
  -FormatterListener::initialize()
  +const XalanDOMChar   FormatterListener::s_piTarget[] =
   {
  -     ::s_xsltNextIsRawString = XALAN_STATIC_UCODE_STRING("raw");
  -
  -     ::s_formatterListenerString = 
XALAN_STATIC_UCODE_STRING("formatter-listener");
  -}
  -
  +     XalanUnicode::charLetter_X,
  +     XalanUnicode::charLetter_a,
  +     XalanUnicode::charLetter_l,
  +     XalanUnicode::charLetter_a,
  +     XalanUnicode::charLetter_n,
  +     0
  +};
   
  -
  -void
  -FormatterListener::terminate()
  +const XalanDOMChar   FormatterListener::s_piData[] =
   {
  -     releaseMemory(::s_xsltNextIsRawString);
  -
  -     releaseMemory(::s_formatterListenerString);
  -}
  +     XalanUnicode::charLetter_r,
  +     XalanUnicode::charLetter_a,
  +     XalanUnicode::charLetter_w,
  +     0
  +};
  
  
  
  1.6       +4 -17     xml-xalan/c/src/PlatformSupport/FormatterListener.hpp
  
  Index: FormatterListener.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/FormatterListener.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FormatterListener.hpp     10 Apr 2002 06:05:55 -0000      1.5
  +++ FormatterListener.hpp     5 Sep 2002 01:11:31 -0000       1.6
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -95,19 +95,6 @@
        // A handy typedef...  Must match DocumentHandler's type for 
characters(), etc...
        typedef unsigned int    size_type;
   
  -     /**
  -      * Perform static initialization.  See class XMLSupportInit.
  -      */
  -     static void
  -     initialize();
  -
  -     /**
  -      * Perform static shut down.  See class XMLSupportInit.
  -      */
  -     static void
  -     terminate();
  -
  -
        enum eFormat
        {
                OUTPUT_METHOD_NONE = 0,
  @@ -251,9 +238,9 @@
   
        // Used when creating PI to work around limitations of
        // our interfaces...
  -     static const XalanDOMString&    s_xsltNextIsRawString;
  +     static const XalanDOMChar       s_piTarget[];
   
  -     static const XalanDOMString&    s_formatterListenerString;
  +     static const XalanDOMChar       s_piData[];
   
   protected:
   
  
  
  
  1.6       +0 -10     xml-xalan/c/src/PlatformSupport/PlatformSupportInit.cpp
  
  Index: PlatformSupportInit.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/PlatformSupportInit.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PlatformSupportInit.cpp   2 May 2001 15:40:22 -0000       1.5
  +++ PlatformSupportInit.cpp   5 Sep 2002 01:11:31 -0000       1.6
  @@ -59,8 +59,6 @@
   
   
   
  -#include "DOMStringHelper.hpp"
  -#include "FormatterListener.hpp"
   #include "XalanTranscodingServices.hpp"
   
   
  @@ -97,11 +95,7 @@
   void
   PlatformSupportInit::initialize()
   {
  -     DOMStringHelperInitialize();
  -
        XalanTranscodingServices::initialize();
  -
  -     FormatterListener::initialize();
   }
   
   
  @@ -109,9 +103,5 @@
   void
   PlatformSupportInit::terminate()
   {
  -     FormatterListener::terminate();
  -
        XalanTranscodingServices::terminate();
  -
  -     DOMStringHelperTerminate();
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to