Skip to content

Commit 9dab425

Browse files
committed
Reverted patch for tsearch/spell.c, merged from the REL9_5_STABLE branch, because it breaks Artur's improvements to dictionary load code
1 parent 481ce16 commit 9dab425

File tree

1 file changed

+7
-21
lines changed

1 file changed

+7
-21
lines changed

src/backend/tsearch/spell.c

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -216,19 +216,6 @@ findchar(char *str, int c)
216216
return NULL;
217217
}
218218

219-
static char *
220-
findchar2(char *str, int c1, int c2)
221-
{
222-
while (*str)
223-
{
224-
if (t_iseq(str, c1) || t_iseq(str, c2))
225-
return str;
226-
str += pg_mblen(str);
227-
}
228-
229-
return NULL;
230-
}
231-
232219

233220
/* backward string compare for suffix tree operations */
234221
static int
@@ -1233,8 +1220,9 @@ NIImportOOAffixes(IspellDict *Conf, const char *filename)
12331220

12341221
if (flag == 0)
12351222
goto nextline;
1236-
/* Get flags after '/' (flags are case sensitive) */
1237-
if ((ptr = strchr(repl, '/')) != NULL)
1223+
prepl = lowerstr_ctx(Conf, repl);
1224+
/* Find position of '/' in lowercased string "prepl" */
1225+
if ((ptr = strchr(prepl, '/')) != NULL)
12381226
{
12391227
/*
12401228
* Here we use non-lowercased string "repl". We need position
@@ -1244,10 +1232,6 @@ NIImportOOAffixes(IspellDict *Conf, const char *filename)
12441232
ptr = repl + (ptr - prepl) + 1;
12451233
aflg |= getFlagValues(Conf, getFlags(Conf, ptr));
12461234
}
1247-
/* Get lowercased version of string before '/' */
1248-
prepl = lowerstr_ctx(Conf, repl);
1249-
if ((ptr = strchr(prepl, '/')) != NULL)
1250-
*ptr = '\0';
12511235
pfind = lowerstr_ctx(Conf, find);
12521236
pmask = lowerstr_ctx(Conf, mask);
12531237
if (t_iseq(find, '0'))
@@ -1317,10 +1301,12 @@ NIImportAffixes(IspellDict *Conf, const char *filename)
13171301

13181302
if (STRNCMP(pstr, "compoundwords") == 0)
13191303
{
1320-
/* Find case-insensitive L flag in non-lowercased string */
1321-
s = findchar2(recoded, 'l', 'L');
1304+
/* Find position in lowercased string "pstr" */
1305+
s = findchar(pstr, 'l');
13221306
if (s)
13231307
{
1308+
/* Here we use non-lowercased string "recoded" */
1309+
s = recoded + (s - pstr);
13241310
while (*s && !t_isspace(s))
13251311
s += pg_mblen(s);
13261312
while (*s && t_isspace(s))

0 commit comments

Comments
 (0)