Re: Using defines for protocol characters

From: Dave Cramer <davecramer(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, nathandbossart(at)gmail(dot)com
Subject: Re: Using defines for protocol characters
Date: 2023-08-03 18:07:21
Message-ID: CADK3HHJamHtwxP=uVuc=eqc-MtV4L6ORYJH4089fag_PmiQqLA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 3 Aug 2023 at 11:59, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:

> On 2023-Aug-03, Dave Cramer wrote:
>
> > Greetings,
> >
> > Attached is a patch which introduces a file protocol.h. Instead of using
> > the actual characters everywhere in the code this patch names the
> > characters and removes the comments beside each usage.
>
> I saw this one last week. I think it's a very idea (and I fact I had
> thought of doing it when I last messed with libpq code).
>
> I don't really like the name pattern you've chosen though; I think we
> need to have a common prefix in the defines. Maybe prepending PQMSG_ to
> each name would be enough. And maybe turn the _RESPONSE and _REQUEST
> suffixes you added into prefixes as well, so instead of PARSE_REQUEST
> you could make it PQMSG_REQ_PARSE, PQMSG_RESP_BIND_COMPLETE and so
> on.
>
That becomes trivial to do now that the names are defined. I presumed
someone would object to the names.
I'm fine with the names you propose, but I suggest we wait to see if anyone
objects.

Dave

>
> --
> Álvaro Herrera 48°01'N 7°57'E —
> https://www.EnterpriseDB.com/
> <Schwern> It does it in a really, really complicated way
> <crab> why does it need to be complicated?
> <Schwern> Because it's MakeMaker.
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tim Palmer 2023-08-03 18:08:28 Re: Fix incorrect start up costs for WindowAgg paths (bug #17862)
Previous Message Alvaro Herrera 2023-08-03 17:59:40 Re: Using defines for protocol characters