Bug: Contrib\fulltextindex\fti.c?

Paul McGarry <paulm@opentec.com.au>

From: Paul McGarry <paulm@opentec.com.au>
To: pgsql-bugs@hub.org
Date: 2000-07-04T04:03:44Z
Lists: pgsql-bugs
Hello,

Is it me, or does the declaration of difference as an unsigned int
prevent the if statements just below from working correctly?
Should it not be a normal int?

>From postgresql-7.0.2/contrib/fulltextindex/fti.c
======
bool
is_stopword(char *text)
{
	char	  **StopLow;		/* for list of stop-words */
	char	  **StopHigh;
	char	  **StopMiddle;
	unsigned int difference;

	StopLow = &StopWords[0];	/* initialize stuff for binary search */
	StopHigh = endof(StopWords);

	if (lengthof(StopWords) == 0)
		return false;

	while (StopLow <= StopHigh)
	{
		StopMiddle = StopLow + (StopHigh - StopLow) / 2;
		difference = strcmp(*StopMiddle, text);
		if (difference == 0)
			return (true);
		else if (difference < 0)
			StopLow = StopMiddle + 1;
		else
			StopHigh = StopMiddle - 1;
	}

	return (false);
}
======


-- 
Paul McGarry            mailto:paulm@opentec.com.au 
Systems Integrator      http://www.opentec.com.au 
Opentec Pty Ltd         http://www.iebusiness.com.au
6 Lyon Park Road        Phone: (02) 9878 1744 
North Ryde NSW 2113     Fax:   (02) 9878 1755