Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6d87107 commit 4e71240Copy full SHA for 4e71240
contrib/fulltextindex/fti.c
@@ -351,10 +351,9 @@ is_stopword(char *text)
351
StopLow = &StopWords[0]; /* initialize stuff for binary search */
352
StopHigh = endof(StopWords);
353
354
- if (lengthof(StopWords) == 0)
355
- return false;
+ /* Loop invariant: *StopLow <= text < *StopHigh */
356
357
- while (StopLow <= StopHigh)
+ while (StopLow < StopHigh)
358
{
359
StopMiddle = StopLow + (StopHigh - StopLow) / 2;
360
difference = strcmp(*StopMiddle, text);
@@ -363,7 +362,7 @@ is_stopword(char *text)
363
362
else if (difference < 0)
364
StopLow = StopMiddle + 1;
365
else
366
- StopHigh = StopMiddle - 1;
+ StopHigh = StopMiddle;
367
}
368
369
return (false);
0 commit comments