Re: assorted code cleanup

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: assorted code cleanup
Date: 2017-09-06 06:01:38
Message-ID: CAB7nPqSZ_eV31SEfv5G6ErPuhWEgbKuougX=WJMkJ2XT32D+mw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 6, 2017 at 4:12 AM, Peter Eisentraut
<peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote:
> On 8/21/17 01:11, Michael Paquier wrote:
>>> - Drop excessive dereferencing of function pointers
>>
>> - (*next_ProcessUtility_hook) (pstmt, queryString,
>> + next_ProcessUtility_hook(pstmt, queryString,
>> context, params, queryEnv,
>> dest, completionTag);
>> But this... Personally I like the current grammar which allows one to
>> make the difference between a function call with something declared
>> locally and something that may be going to a custom code path. So I
>> think that you had better not update the system hooks that external
>> modules can use via shared_preload_libraries.
>
> Do you mean specifically the hook variables, or any function pointers?
> I can see your point in the above case, but for example here
>
> - if ((*tinfo->f_lt) (o.upper, c.upper, flinfo))
> + if (tinfo->f_lt(o.upper, c.upper, flinfo))
>
> I think there is no loss of clarity and the extra punctuation makes it
> more complicated to read.

I am referring only to hook variables here. For functions only used
internally by the backend, I agree that using a direct point to those
functions makes things better, because it is more easily possible to
make a difference with the hook paths. Keeping a different grammar for
local code and hook code allows readers to make a clearer difference
that both things have different concepts.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2017-09-06 06:28:47 Re: DROP SUBSCRIPTION hangs if sub is disabled in the same transaction
Previous Message Michael Paquier 2017-09-06 05:49:05 Re: [PATCH] Assert that the correct locks are held when calling PageGetLSN()