Re: Missing CFI in iterate_word_similarity() - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Missing CFI in iterate_word_similarity()
Date
Msg-id 940637.1662124573@sss.pgh.pa.us
Whole thread Raw
In response to Re: Missing CFI in iterate_word_similarity()  (Daniel Gustafsson <daniel@yesql.se>)
Responses Re: Missing CFI in iterate_word_similarity()
List pgsql-hackers
Daniel Gustafsson <daniel@yesql.se> writes:
>> On 2 Sep 2022, at 14:57, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I noticed the same thing, but sticking the CFI immediately after the
>> declaration didn't read well either.  I was considering moving it to
>> the bottom of the loop instead of that.

> I was contemplating that too, but kept it at the top after seeing quite a few
> examples of that in other contrib modules (like amcheck/verify_nbtree.c and
> pg_visibility/pg_visibility.c).  I don't have any strong feelings either way,
> I'm happy to move it last.

You could keep it at the top, but then I'd be inclined to split up
the existing code:

        int            trgindex;

        CHECK_FOR_INTERRUPTS();

        /* Get index of next trigram */
        trgindex = trg2indexes[i];

        /* Update last position of this trigram */
        ...

What's annoying me about the one-liner fix is that it makes it
look like CFI is part of the "Get index" action.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Re: Missing CFI in iterate_word_similarity()
Next
From: Magnus Hagander
Date:
Subject: Re: windows resource files, bugs and what do we actually want