mirror of https://github.com/postgres/postgres
Fix stopword and synonym files parsing bug in MSVC build, per report from
Magnus Hagander. Also, now it ignores space symbol after stopwords.
This commit is contained in:
parent
a6fbd2f12a
commit
debb3aa8e9
|
@ -1,4 +1,4 @@
|
|||
/* $PostgreSQL: pgsql/contrib/tsearch2/dict_syn.c,v 1.12 2007/02/08 11:10:26 petere Exp $ */
|
||||
/* $PostgreSQL: pgsql/contrib/tsearch2/dict_syn.c,v 1.13 2007/03/26 12:25:35 teodor Exp $ */
|
||||
|
||||
/*
|
||||
* ISpell interface
|
||||
|
@ -40,7 +40,7 @@ findwrd(char *in, char **end)
|
|||
while (*in && isspace((unsigned char) *in))
|
||||
in++;
|
||||
|
||||
if (!in)
|
||||
if (*in=='\0')
|
||||
return NULL;
|
||||
start = in;
|
||||
|
||||
|
@ -103,10 +103,7 @@ syn_init(PG_FUNCTION_ARGS)
|
|||
|
||||
while (fgets(buf, sizeof(buf), fin))
|
||||
{
|
||||
slen = strlen(buf) - 1;
|
||||
buf[slen] = '\0';
|
||||
if (*buf == '\0')
|
||||
continue;
|
||||
pg_verifymbstr(buf, strlen(buf), false);
|
||||
if (cur == d->len)
|
||||
{
|
||||
d->len = (d->len) ? 2 * d->len : 16;
|
||||
|
|
|
@ -47,9 +47,13 @@ readstoplist(text *in, StopList * s)
|
|||
|
||||
while (fgets(buf, sizeof(buf), hin))
|
||||
{
|
||||
buf[strlen(buf) - 1] = '\0';
|
||||
pbuf = buf;
|
||||
while( !isspace( *pbuf ) )
|
||||
pbuf++;
|
||||
*pbuf = '\0';
|
||||
|
||||
pg_verifymbstr(buf, strlen(buf), false);
|
||||
if (*buf == '\0')
|
||||
if (*buf == '\0' || *buf=='\n' || *buf=='\r')
|
||||
continue;
|
||||
|
||||
if (s->len >= reallen)
|
||||
|
|
Loading…
Reference in New Issue