Fixes from Heikki Linnakangas <heikki@enterprisedb.com>:
authorTeodor Sigaev <teodor@sigaev.ru>
Mon, 10 Sep 2007 10:39:56 +0000 (10:39 +0000)
committerTeodor Sigaev <teodor@sigaev.ru>
Mon, 10 Sep 2007 10:39:56 +0000 (10:39 +0000)
Apparently it's a bug I introduced when I refactored spell.c to use the
readline function for reading and recoding the input file. I didn't
notice that some calls to STRNCMP used the non-lowercased version of the
input line.

src/backend/tsearch/spell.c

index 6ff3034ddf8e27cb656e1ba503e0e32cacdd9694..3601cfc5621e528908e01c041b99d908e9c5c1a1 100644 (file)
@@ -733,7 +733,6 @@ NIImportAffixes(IspellDict * Conf, const char *filename)
        while ((recoded = t_readline(affix)) != NULL)
        {
                pstr = lowerstr(recoded);
-               pfree(recoded);
 
                lineno++;
 
@@ -813,8 +812,8 @@ NIImportAffixes(IspellDict * Conf, const char *filename)
                        flag = (unsigned char) *s;
                        goto nextline;
                }
-               if (STRNCMP(str, "COMPOUNDFLAG") == 0 || STRNCMP(str, "COMPOUNDMIN") == 0 ||
-                       STRNCMP(str, "PFX") == 0 || STRNCMP(str, "SFX") == 0)
+               if (STRNCMP(recoded, "COMPOUNDFLAG") == 0 || STRNCMP(recoded, "COMPOUNDMIN") == 0 ||
+                       STRNCMP(recoded, "PFX") == 0 || STRNCMP(recoded, "SFX") == 0)
                {
                        if (oldformat)
                                ereport(ERROR,
@@ -834,6 +833,7 @@ NIImportAffixes(IspellDict * Conf, const char *filename)
                NIAddAffix(Conf, flag, flagflags, mask, find, repl, suffixes ? FF_SUFFIX : FF_PREFIX);
 
        nextline:
+               pfree(recoded);
                pfree(pstr);
        }
        FreeFile(affix);