Commit debb3aa8 authored by Teodor Sigaev's avatar Teodor Sigaev

Fix stopword and synonym files parsing bug in MSVC build, per report from

Magnus Hagander. Also, now it ignores space symbol after stopwords.
parent a6fbd2f1
/* $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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment