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/08 19:25:17 UTC

cvs commit: xml-xalan/c/src/XPath XObject.cpp

dbertoni    01/01/08 10:25:17

  Modified:    c/src/XPath XObject.cpp
  Log:
  Used better variable scoping.
  
  Revision  Changes    Path
  1.19      +26 -17    xml-xalan/c/src/XPath/XObject.cpp
  
  Index: XObject.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/XObject.cpp,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- XObject.cpp	2001/01/03 19:32:39	1.18
  +++ XObject.cpp	2001/01/08 18:25:17	1.19
  @@ -307,32 +307,41 @@
   	bool				theResult = false;
   
   	const unsigned int	len1 = theLHSNodeSet.getLength();
  -	const unsigned int	len2 = theRHSNodeSet.getLength();
   
  -	for(unsigned int i = 0; i < len1 && theResult == false; i++)
  +	if (len1 > 0)
   	{
  -		const XalanNode* const	theLHSNode = theLHSNodeSet.item(i);
  -		assert(theLHSNode != 0);
  +		const unsigned int	len2 = theRHSNodeSet.getLength();
   
  -		XPathExecutionContext::GetAndReleaseCachedString	s1(executionContext);
  +		if (len2 > 0)
  +		{
  +			XPathExecutionContext::GetAndReleaseCachedString	s1(executionContext);
   
  -		theTypeFunction(*theLHSNode, s1);
  +			XPathExecutionContext::GetAndReleaseCachedString	s2(executionContext);
   
  -		XPathExecutionContext::GetAndReleaseCachedString	s2(executionContext);
  +			for(unsigned int i = 0; i < len1 && theResult == false; i++)
  +			{
  +				const XalanNode* const	theLHSNode = theLHSNodeSet.item(i);
  +				assert(theLHSNode != 0);
   
  -		for(unsigned int k = 0; k < len2 && theResult == false; k++)
  -		{
  -			const XalanNode* const	theRHSNode = theRHSNodeSet.item(k);
  -			assert(theRHSNode != 0);
  +				theTypeFunction(*theLHSNode, s1);
   
  -			theTypeFunction(*theRHSNode, s2);
  +				for(unsigned int k = 0; k < len2 && theResult == false; k++)
  +				{
  +					const XalanNode* const	theRHSNode = theRHSNodeSet.item(k);
  +					assert(theRHSNode != 0);
   
  -			if(theCompareFunction(s1, s2) == true)
  -			{
  -				theResult = true;
  -			}
  +					theTypeFunction(*theRHSNode, s2);
  +
  +					if(theCompareFunction(s1, s2) == true)
  +					{
  +						theResult = true;
  +					}
   
  -			clear(s2);
  +					clear(s2);
  +				}
  +
  +				clear(s1);
  +			}
   		}
   	}