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 2003/01/03 22:44:42 UTC

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

dbertoni    2003/01/03 13:44:42

  Modified:    c/src/XSLT FunctionSystemProperty.cpp
  Log:
  Fixed unnecessary string creation.
  
  Revision  Changes    Path
  1.26      +13 -19    xml-xalan/c/src/XSLT/FunctionSystemProperty.cpp
  
  Index: FunctionSystemProperty.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionSystemProperty.cpp,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- FunctionSystemProperty.cpp	25 Nov 2002 18:11:52 -0000	1.25
  +++ FunctionSystemProperty.cpp	3 Jan 2003 21:44:42 -0000	1.26
  @@ -109,12 +109,6 @@
   	const XalanDOMString::size_type		fullNameLength = length(fullName);
   	const XalanDOMString::size_type		indexOfNSSep = indexOf(fullName, XalanUnicode::charColon);
   
  -	bool			fNumberResult = false;
  -
  -	XalanDOMString	result;
  -
  -	double			numberResult = 0.0;
  -
   	if(indexOfNSSep < fullNameLength)
   	{
   		XPathExecutionContext::GetAndReleaseCachedString	guard(executionContext);
  @@ -133,17 +127,15 @@
   			{
   				if(equals(theBuffer, m_versionPropertyString))
   				{
  -					numberResult = 1.0;
  -
  -					fNumberResult = true;
  +					return executionContext.getXObjectFactory().createNumber(1.0);
   				}
   				else if(equals(theBuffer, m_vendorPropertyString))
   				{
  -					result = m_vendorString;
  +					return executionContext.getXObjectFactory().createStringReference(m_vendorString);
   				}
   				else if(equals(theBuffer, m_vendorURLPropertyString))
   				{
  -					result = m_vendorURLString;
  +					return executionContext.getXObjectFactory().createStringReference(m_vendorURLString);
   				}
   				else
   				{
  @@ -180,18 +172,20 @@
   		}
   		else
   		{
  +			XPathExecutionContext::GetAndReleaseCachedString	guard(executionContext);
  +
  +			XalanDOMString&		result = guard.get();
  +
   			result = TranscodeFromLocalCodePage(theEnvString);
  +
  +			return executionContext.getXObjectFactory().createString(result);
   		}
   	}
   
  -	if (fNumberResult == true)
  -	{
  -		return executionContext.getXObjectFactory().createNumber(numberResult);
  -	}
  -	else
  -	{
  -		return executionContext.getXObjectFactory().createString(result);
  -	}
  +	// We should never get here...
  +	assert(false);
  +
  +	return XObjectPtr();
   }
   
   
  
  
  

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