pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Constify the arguments of ilist.c/h functions
Date: Thu, 12 Jan 2023 07:14:51 +0000
Message-ID: <E1pFrnW-003FOL-QB@gemulon.postgresql.org> (raw)

Constify the arguments of ilist.c/h functions

Const qualifiers ensure that we don't do something stupid in the
function implementation.  Additionally they clarify the interface.  As
an example:

    void
    slist_delete(slist_head *head, const slist_node *node)

Here one can instantly tell that node->next is not going to be set to
NULL.  Finally, const qualifiers potentially allow the compiler to do
more optimizations.  This being said, no benchmarking was done for
this patch.

The functions that return non-const pointers like slist_next_node(),
dclist_next_node() etc. are not affected by the patch intentionally.

Author: Aleksander Alekseev
Reviewed-by: Andres Freund
Discussion: https://postgr.es/m/CAJ7c6TM2%3D08mNKD9aJg8vEY9hd%2BG4L7%2BNvh30UiNT3kShgRgNg%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c8ad4d8166aabd6ed5124e7e432166637d0fe646

Modified Files
--------------
src/backend/lib/ilist.c |  8 ++++----
src/include/lib/ilist.h | 26 +++++++++++++-------------
2 files changed, 17 insertions(+), 17 deletions(-)



Message-ID: <E1pFrnW-003FOL-QB@gemulon.postgresql.org>
Permalink:  ../E1pFrnW-003FOL-QB@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pFrnW-003FOL-QB@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: peter@eisentraut.org
  Subject: Re: pgsql: Constify the arguments of ilist.c/h functions
  In-Reply-To: <E1pFrnW-003FOL-QB@gemulon.postgresql.org>
  References: <E1pFrnW-003FOL-QB@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