xerces-cvs@xml.apache.org
[Top] [All Lists]

cvs commit: xml-xerces/c/src/xercesc/util/regx RegularExpression.cpp Reg

Subject: cvs commit: xml-xerces/c/src/xercesc/util/regx RegularExpression.cpp RegularExpression.hpp
From:
Date: 5 Apr 2005 18:18:34 -0000
knoaman     2005/04/05 11:18:34

  Modified:    c/src/xercesc/util/regx RegularExpression.cpp
                        RegularExpression.hpp
  Log:
  Performance: do not make a copy of the expression to match.
  
  Revision  Changes    Path
  1.25      +6 -16     xml-xerces/c/src/xercesc/util/regx/RegularExpression.cpp
  
  Index: RegularExpression.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/regx/RegularExpression.cpp,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- RegularExpression.cpp     1 Apr 2005 17:36:25 -0000       1.24
  +++ RegularExpression.cpp     5 Apr 2005 18:18:34 -0000       1.25
  @@ -16,6 +16,9 @@
   
   /*
    * $Log$
  + * Revision 1.25  2005/04/05 18:18:34  knoaman
  + * Performance: do not make a copy of the expression to match.
  + *
    * Revision 1.24  2005/04/01 17:36:25  dbertoni
    * Fix for Jira issue XERCESC-1389.
    *
  @@ -168,11 +171,9 @@
   
   RegularExpression::Context::~Context()
   {
  -     if (fOffsets)
  +    if (fOffsets)
           fMemoryManager->deallocate(fOffsets);//delete [] fOffsets;
   
  -    fMemoryManager->deallocate(fString);//delete [] fString;
  -
        if (fAdoptMatch)
                delete fMatch;
   }
  @@ -186,19 +187,8 @@
                                          , const int limit
                                          , const int noClosures)
   {
  -    if (stringLen > fStringMaxLen || !fString) {
  -
  -        fStringMaxLen = stringLen;
  -
  -        if (fString)
  -            fMemoryManager->deallocate(fString);
  -
  -        fString = XMLString::replicate(string, fMemoryManager);
  -    }
  -    else {
  -        memcpy(fString, string, (stringLen + 1) * sizeof(XMLCh));
  -    }
  -
  +    fString = string;
  +    fStringMaxLen = stringLen;
        fStart = start;
        fLimit = limit;
        fLength = fLimit - fStart;      
  
  
  
  1.20      +10 -12    xml-xerces/c/src/xercesc/util/regx/RegularExpression.hpp
  
  Index: RegularExpression.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/regx/RegularExpression.hpp,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- RegularExpression.hpp     8 Sep 2004 13:56:47 -0000       1.19
  +++ RegularExpression.hpp     5 Apr 2005 18:18:34 -0000       1.20
  @@ -154,18 +154,16 @@
                          const int start, const int limit, const int 
noClosures);
               bool nextCh(XMLInt32& ch, int& offset, const short direction);
               
  -            bool      fAdoptMatch;
  -            int       fStart;
  -            int       fLimit;
  -            int       fLength;    // fLimit - fStart
  -            int       fSize;
  -            int       fStringMaxLen;
  -            int*      fOffsets;
  -            Match*    fMatch;
  -            XMLCh*    fString;
  +            bool           fAdoptMatch;
  +            int            fStart;
  +            int            fLimit;
  +            int            fLength;    // fLimit - fStart
  +            int            fSize;
  +            int            fStringMaxLen;
  +            int*           fOffsets;
  +            Match*         fMatch;
  +            const XMLCh*   fString;
               MemoryManager* fMemoryManager;
  -
  -            friend class Janitor<Context>;
       };
   
       // 
-----------------------------------------------------------------------
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xxxxxxxxxxxxxx
For additional commands, e-mail: xerces-cvs-help@xxxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>
  • cvs commit: xml-xerces/c/src/xercesc/util/regx RegularExpression.cpp RegularExpression.hpp, knoaman <=