Re: Missing CFI in iterate_word_similarity()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: Robins Tharakan <tharakan(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Missing CFI in iterate_word_similarity()
Date: 2022-09-02 13:16:13
Message-ID: 940637.1662124573@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Daniel Gustafsson <daniel(at)yesql(dot)se> writes:
>> On 2 Sep 2022, at 14:57, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2022-09-02 13:18:55 Re: windows resource files, bugs and what do we actually want
Previous Message Daniel Gustafsson 2022-09-02 13:06:34 Re: Missing CFI in iterate_word_similarity()