pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@postgresql.org
Subject: pgsql: Clarify the new Red-Black post-order traversal code a bit.
Date: Sun, 04 Sep 2016 12:02:12 +0000
Message-ID: <E1bgW7o-0004IK-7I@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Clarify the new Red-Black post-order traversal code a bit.

Coverity complained about the for(;;) loop, because it never actually
iterated. It was used just to be able to use "break" to exit it early. I
agree with Coverity, that's a bit confusing, so refactor the code to
use if-else instead.

While we're at it, use a local variable to hold the "current" node. That's
shorter and clearer than referring to "iter->last_visited" all the time.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/e21db14b8a6696a2b704b89df9c4be9cd0ea8a33

Modified Files
--------------
src/backend/lib/rbtree.c | 46 ++++++++++++++++++++++++----------------------
1 file changed, 24 insertions(+), 22 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Message-ID: <E1bgW7o-0004IK-7I@gemulon.postgresql.org>
Permalink:  ../E1bgW7o-0004IK-7I@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1bgW7o-0004IK-7I@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: heikki.linnakangas@iki.fi
  Subject: Re: pgsql: Clarify the new Red-Black post-order traversal code a bit.
  In-Reply-To: <E1bgW7o-0004IK-7I@gemulon.postgresql.org>
  References: <E1bgW7o-0004IK-7I@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox