You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by sa...@apache.org on 2003/01/20 17:32:59 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/impl/xs/traversers XSDAbstractParticleTraverser.java

sandygao    2003/01/20 08:32:59

  Modified:    java/src/org/apache/xerces/impl/xs/traversers
                        XSDAbstractParticleTraverser.java
  Log:
  Small performance fix: if the number of particle is 0, we don't need to
  always create an array of length 0.
  
  Revision  Changes    Path
  1.12      +9 -6      xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDAbstractParticleTraverser.java
  
  Index: XSDAbstractParticleTraverser.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDAbstractParticleTraverser.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- XSDAbstractParticleTraverser.java	26 Jul 2002 18:59:18 -0000	1.11
  +++ XSDAbstractParticleTraverser.java	20 Jan 2003 16:32:59 -0000	1.12
  @@ -381,11 +381,14 @@
           // end the current context, and return an array of particles
           XSParticleDecl[] popContext() {
               int count = fPos[fContextCount] - fPos[fContextCount-1];
  -            XSParticleDecl[] array = new XSParticleDecl[count];
  -            System.arraycopy(fParticles, fPos[fContextCount-1], array, 0, count);
  -            // clear the particle array, to release memory
  -            for (int i = fPos[fContextCount-1]; i < fPos[fContextCount]; i++)
  -                fParticles[i] = null;
  +            XSParticleDecl[] array = null;
  +            if (count != 0) {
  +                array = new XSParticleDecl[count];
  +                System.arraycopy(fParticles, fPos[fContextCount-1], array, 0, count);
  +                // clear the particle array, to release memory
  +                for (int i = fPos[fContextCount-1]; i < fPos[fContextCount]; i++)
  +                    fParticles[i] = null;
  +            }
               fContextCount--;
               return array;
           }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org