Bug: Contrib\fulltextindex\fti.c? - Mailing list pgsql-bugs

From Paul McGarry
Subject Bug: Contrib\fulltextindex\fti.c?
Date
Msg-id 39616220.37A6E4DB@opentec.com.au
Whole thread Raw
Responses Re: Bug: Contrib\fulltextindex\fti.c?  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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

pgsql-bugs by date:

Previous
From: Gena Gurchonok
Date:
Subject: Rule system
Next
From: Tom Lane
Date:
Subject: Re: Bug: Contrib\fulltextindex\fti.c?