Re: small pg_dump code cleanup - Mailing list pgsql-hackers

From Neil Conway
Subject Re: small pg_dump code cleanup
Date
Msg-id CAOW5sYZY3sdSxzaRwQCMMNtsZ_1jN+AFzB82k58==Vome-G11w@mail.gmail.com
Whole thread Raw
In response to small pg_dump code cleanup  (Nathan Bossart <nathandbossart@gmail.com>)
Responses Re: small pg_dump code cleanup
List pgsql-hackers
On Wed, Jun 5, 2024 at 11:14 AM Nathan Bossart <nathandbossart@gmail.com> wrote:
 In fact, many of the functions in this area don't actually need to
return anything, so we can trim some code and hopefully reduce confusion a
bit.  Patch attached.

Nice cleanup! Two minor comments:

(1) Names like `getXXX` for these functions suggest to me that they return a value, rather than side-effecting. I realize some variants continue to return a value, but the majority no longer do. Perhaps a name like lookupXXX() or readXXX() would be clearer?

(2) These functions malloc() a single ntups * sizeof(struct) allocation and then index into it to fill-in each struct before entering it into the hash table. It might be more straightforward to just malloc each individual struct.

Neil

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Make query cancellation keys longer
Next
From: Nathan Bossart
Date:
Subject: Re: small pg_dump code cleanup