while (s >= searchBuf) { if (CharsMatch(*patternBuf, *s)) { const PRUnichar	*t = s; const PRUnichar	*p = patternBuf; PRInt32		curMatchOffset = t - searchBuf; PRBool		inWhitespace = nsString::IsSpace(*p);  while (p < patEnd && CharsMatch(*p, *t)) { if (inWhitespace && !nsString::IsSpace(*p)) {  while (t < searchEnd - 1 && nsString::IsSpace(*(t + 1))) t ++;  inWhitespace = false; } else inWhitespace = nsString::IsSpace(*p);  t ++; p ++; }  if (p == patEnd) { foundOffset = curMatchOffset; goto done; }   }  s --; }
static PRInt32 FindInString(const nsString &searchStr, const nsString &patternStr,						PRInt32 startOffset, PRBool searchBackwards){	PRInt32		foundOffset = -1;	PRInt32		patternLen = patternStr.Length();	PRInt32		searchStrLen = searchStr.Length();			// pattern is empty	if (patternLen == 0)		return -1;		if (startOffset < 0)		startOffset = 0;		if (startOffset >= searchStrLen)		return -1;		const PRUnichar	*searchBuf = searchStr.GetUnicode();	const PRUnichar	*patternBuf = patternStr.GetUnicode();	const PRUnichar	*searchEnd = searchBuf + searchStrLen;	const PRUnichar	*patEnd = patternBuf + patternLen;		if (searchBackwards)	{		// searching backwards								}	else	{		// searching forwards				const PRUnichar	*s = &searchBuf[startOffset];			while (s < searchEnd)		{			if (CharsMatch(*patternBuf, *s))			// start potential match			{				const PRUnichar	*t = s;				const PRUnichar	*p = patternBuf;				PRInt32		curMatchOffset = t - searchBuf;				PRBool		inWhitespace = PR_FALSE;								while (p < patEnd && CharsMatch(*p, *s))				{					if (inWhitespace && !nsString::IsSpace(*p))					{						// leaving p whitespace. Eat up addition whitespace in s						while (s < searchEnd - 1 && nsString::IsSpace(*(s + 1)))							s ++;													inWhitespace = PR_FALSE;					}					else						inWhitespace = nsString::IsSpace(*p);					s ++;					p ++;				}								if (p == patEnd)				{					foundOffset = curMatchOffset;					goto done;				}								// could be smart about incrementing s here			}						s ++;		}			}done:	return foundOffset;}