Re: tsearch2 regression test failures

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Teodor Sigaev <teodor(at)sigaev(dot)ru>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PGSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: tsearch2 regression test failures
Date: 2007-03-26 10:58:21
Message-ID: 20070326105821.GC1533@svr2.hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Mar 26, 2007 at 02:32:26PM +0400, Teodor Sigaev wrote:
> >FWIW, it looks like it failed to reject stopwords. Is it possible you
> Right.
>
> I suppose the problem is with '\r\n'... Try attached patch.
> --
> Teodor Sigaev E-mail: teodor(at)sigaev(dot)ru
> WWW:
> http://www.sigaev.ru/

> *** ./contrib/tsearch2/stopword.c.orig Mon Mar 26 14:25:16 2007
> --- ./contrib/tsearch2/stopword.c Mon Mar 26 14:28:25 2007
> ***************
> *** 47,53 ****
>
> while (fgets(buf, sizeof(buf), hin))
> {
> ! buf[strlen(buf) - 1] = '\0';
> pg_verifymbstr(buf, strlen(buf), false);
> if (*buf == '\0')
> continue;
> --- 47,57 ----
>
> while (fgets(buf, sizeof(buf), hin))
> {
> ! pbuf = buf;
> ! while( !isspace( *pbuf ) )
> ! pbuf++;
> ! *pbuf = '\0';
> !
> pg_verifymbstr(buf, strlen(buf), false);
> if (*buf == '\0')
> continue;

Yup, that solved the problem, thanks.

Wouldn't it be more efficiently written to walk the string backwards until
!isspace instead? Not sure that it matters at all, but then you'll
normallyi never step over more than two bytes...

//Magnus

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Huxton 2007-03-26 11:03:08 Re: Group Commit
Previous Message Heikki Linnakangas 2007-03-26 10:39:16 Group Commit