Re: Small const correctness patch

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: markg735(at)gmail(dot)com
Cc: peter(dot)eisentraut(at)2ndquadrant(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Small const correctness patch
Date: 2019-08-09 08:23:16
Message-ID: 20190809.172316.208135395.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Thu, 8 Aug 2019 22:56:02 +0300, Mark G <markg735(at)gmail(dot)com> wrote in <CAEeOP_Y3SAXe8u++9e-CN_+MgY9_u+vu3a80sw+7gzR4s7KjqQ(at)mail(dot)gmail(dot)com>
> On Thu, Aug 8, 2019 at 8:51 PM Peter Eisentraut <
> peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote:
>
>
> > How did you find this? Any special compiler settings?
> >
>
> 16 hours stuck in a plane on an international flight. I was just eyeballing
> the code to kill the boredom.

A similar loose typing is seen, for example:p

-const char *
+const char * const

src/backend/access/rmgrdesc/*.c
relmap_identify(uint8 info)
seq_identify(uint8 info)
smgr_identify(uint8 info)
.... (many)...

src/backend/access/transam/xact.c:
BlockStateAsString(TBlockState blockState)

I foundnd them by

find $(TOP) -type f -exec egrep -nH -e '^(static )?const char \*' {} +

then eyeballing on the first ones. I don't know an automated way
to detect such possibly-loose constness of variables or
functions.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2019-08-09 08:29:14 Re: POC: Cleaning up orphaned files using undo logs
Previous Message Dmitry Igrishin 2019-08-09 08:21:52 Re: Small patch to fix build on Windows