dbertoni    2002/10/10 18:57:24

  Modified:    c/src/XPath FunctionConcat.cpp
  Log:
  Don't cast to strings any more, or reserve space in the result string.
  
  Revision  Changes    Path
  1.13      +9 -37     xml-xalan/c/src/XPath/FunctionConcat.cpp
  
  Index: FunctionConcat.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionConcat.cpp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- FunctionConcat.cpp        26 Sep 2001 20:58:46 -0000      1.12
  +++ FunctionConcat.cpp        11 Oct 2002 01:57:24 -0000      1.13
  @@ -86,15 +86,10 @@
   
        XPathExecutionContext::GetAndReleaseCachedString        
theResult(executionContext);
   
  -     XalanDOMString&                 theString = theResult.get();
  -
  -     const XalanDOMString&   theArg1 = arg1->str();
  -     const XalanDOMString&   theArg2 = arg2->str();
  -
  -     reserve(theString, length(theArg1) + length(theArg2) + 1);
  +     XalanDOMString&         theString = theResult.get();
   
  -     append(theString, theArg1);
  -     append(theString, theArg2);
  +     arg1->str(theString);
  +     arg2->str(theString);
   
        return executionContext.getXObjectFactory().createString(theResult);
   }
  @@ -116,15 +111,9 @@
   
        XalanDOMString&                 theString = theResult.get();
   
  -     const XalanDOMString&   theArg1 = arg1->str();
  -     const XalanDOMString&   theArg2 = arg2->str();
  -     const XalanDOMString&   theArg3 = arg3->str();
  -
  -     reserve(theString, length(theArg1) + length(theArg2) + length(theArg3) + 1);
  -
  -     append(theString, theArg1);
  -     append(theString, theArg2);
  -     append(theString, theArg3);
  +     arg1->str(theString);
  +     arg2->str(theString);
  +     arg3->str(theString);
   
        return executionContext.getXObjectFactory().createString(theResult);
   }
  @@ -138,34 +127,17 @@
                        const XObjectArgVectorType&             args,
                        const Locator*                                  /* locator */) 
const
   {
  -     XalanDOMString::size_type       theCombinedLength = 0;
  -
        const XObjectArgVectorType::const_iterator      theEnd = args.end();
   
  -     {
  -             XObjectArgVectorType::const_iterator    i = args.begin();
  -
  -             for(; i != theEnd; ++i)
  -             {
  -                     assert((*i).null() == false);
  -
  -                     theCombinedLength += length((*i)->str());
  -             }
  -     }
  -
        XPathExecutionContext::GetAndReleaseCachedString        
theResult(executionContext);
   
        XalanDOMString&         theString = theResult.get();
   
  -     reserve(theString, theCombinedLength + 1);
  +     XObjectArgVectorType::const_iterator    i = args.begin();
   
  +     for(; i != theEnd; ++i)
        {
  -             XObjectArgVectorType::const_iterator    i = args.begin();
  -
  -             for(; i != theEnd; ++i)
  -             {
  -                     append(theString, (*i)->str());
  -             }
  +             (*i)->str(theString);
        }
   
        return executionContext.getXObjectFactory().createString(theResult);
  
  
  

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

Reply via email to