| From: | Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi> |
|---|---|
| To: | pgsql-committers(at)postgresql(dot)org |
| Subject: | pgsql: Clarify the new Red-Black post-order traversal code a bit. |
| Date: | 2016-09-04 12:02:12 |
| Message-ID: | E1bgW7o-0004IK-7I@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-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(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2016-09-04 16:34:04 | pgsql: Remove useless pg_strdup() operations. |
| Previous Message | Tom Lane | 2016-09-03 19:29:17 | pgsql: Improve readability of the output of psql's \timing command. |