Re: [PATCH] Improve AtSubCommit_childXids

From: Andres Freund <andres(at)anarazel(dot)de>
To: Ranier Vilela <ranier_gyn(at)hotmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Improve AtSubCommit_childXids
Date: 2019-11-13 17:10:39
Message-ID: 20191113171039.2fzf2n6p7ufub474@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2019-11-13 16:18:46 +0000, Ranier Vilela wrote:
> Surely that "s->nChildXids > 0", protects s->childXids to be NULL!
> But, when we exchange the test (s->nChildXids > 0) by (s->childXids != NULL), I believe we have the same protection, because, if "s->childXids" is not NULL, "s->nChildXids" is > 0, naturally.
>
> That way we can improve the function and avoid calling and setting unnecessarily!

Why is this an improvement? And what setting are we removing? You mean
that we reset nChildXids, even if it's already 0? Hard to see how that
matters.

> Bonus: silent compiler warning potential null pointer derenferencing.

Which compiler issues a warning here?

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2019-11-13 17:26:34 Re: global / super barriers (for checksums)
Previous Message Alvaro Herrera 2019-11-13 16:27:54 Re: make pg_attribute_noreturn() work for msvc?