You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2001/01/16 03:38:12 UTC

cvs commit: xml-xalan/c/src/XSLT VariablesStack.cpp VariablesStack.hpp

dbertoni    01/01/15 18:38:12

  Modified:    c/src/XSLT VariablesStack.cpp VariablesStack.hpp
  Log:
  Reduced copying of XObjectPtr instances.
  
  Revision  Changes    Path
  1.10      +15 -9     xml-xalan/c/src/XSLT/VariablesStack.cpp
  
  Index: VariablesStack.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/VariablesStack.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- VariablesStack.cpp	2000/12/04 20:48:35	1.9
  +++ VariablesStack.cpp	2001/01/16 02:38:12	1.10
  @@ -301,7 +301,7 @@
   void
   VariablesStack::pushVariable(
   			const QName&				name,
  -			const XObjectPtr			val,
  +			const XObjectPtr&			val,
   			const ElemTemplateElement*	e)
   {
   	if(elementFrameAlreadyPushed(e) == false)
  @@ -380,12 +380,18 @@
   
   		assert(theEntry->getType() == StackEntry::eVariable);
   
  -		XObjectPtr	theValue(theEntry->getValue());
  +		const XObjectPtr&	theValue = theEntry->getValue();
   
  -		if (theValue.null() == true)
  +		if (theValue.null() == false)
   		{
  +			return theValue;
  +		}
  +		else
  +		{
   			const ElemVariable* const	var = theEntry->getVariable();
   
  +			XObjectPtr					theNewValue;
  +
   			if (var != 0)
   			{
   				XalanNode* const	doc = executionContext.getRootDocument();
  @@ -393,14 +399,14 @@
   
   				SetAndRestoreForceGlobalSearch	theGuard(*this);
   
  -				theValue = var->getValue(executionContext, doc, doc);
  -				assert(theValue.null() == false);
  +				theNewValue = var->getValue(executionContext, doc, doc);
  +				assert(theNewValue.null() == false);
   
  -				theEntry->setValue(theValue);
  +				theEntry->setValue(theNewValue);
   			}
  -		}
   
  -		return theValue;
  +			return theNewValue;
  +		}
   	}
   }
   
  @@ -547,7 +553,7 @@
   
   VariablesStack::StackEntry::StackEntry(
   		const QName*		name,
  -		const XObjectPtr	val) :
  +		const XObjectPtr&	val) :
   	m_type(eVariable),
   	m_qname(name),
   	m_value(val),
  
  
  
  1.8       +3 -3      xml-xalan/c/src/XSLT/VariablesStack.hpp
  
  Index: VariablesStack.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/VariablesStack.hpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- VariablesStack.hpp	2000/12/04 20:48:35	1.7
  +++ VariablesStack.hpp	2001/01/16 02:38:12	1.8
  @@ -256,7 +256,7 @@
   	void
   	pushVariable(
   			const QName&				name,
  -			const XObjectPtr			val,
  +			const XObjectPtr&			val,
   			const ElemTemplateElement*	e);
   
   	/**
  @@ -399,7 +399,7 @@
   		 */
   		StackEntry(
   			const QName*		name,
  -			const XObjectPtr	val);
  +			const XObjectPtr&	val);
   
   		/**
   		 * Construct a variable that has not been evaluated yet.
  @@ -451,7 +451,7 @@
   		 * 
   		 * @return pointer to XObject
   		 */
  -		const XObjectPtr
  +		const XObjectPtr&
   		getValue() const
   		{
   			return m_value;