Re: use the malloc macros in pg_dump.c
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Peter Smith <smithpb2250@gmail.com>
Cc: Aleksander Alekseev <aleksander@tigerdata.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-02-13T08:22:38Z
Lists: pgsql-hackers
On Fri, Feb 13, 2026 at 06:06:26PM +1100, Peter Smith wrote: > At the same time, I combined all previous patches. That's a practice better than sending a handful bag of patches that each touch one single file. :) Seems globally clean to me, except for two changes. - zp = gzipcs->zp = (z_streamp) pg_malloc(sizeof(z_stream)); + zp = gzipcs->zp = (z_streamp) pg_malloc_object(z_stream); [...] - zp = (z_streamp) pg_malloc(sizeof(z_stream)); + zp = (z_streamp) pg_malloc_object(z_stream); These two defeat the purpose of the change. _object is useful because we can enforce type checks based on their size. Note that We have this declaration in zlib: zlib.h:typedef z_stream FAR *z_streamp; So we should be OK with dropping the casts entirely, with I guess compilers not warning if types do not match as an effect of this typedef declaration. I have removed these, and things seem OK here, now to say if the buildfarm is entirely OK will be a different thing. I'll see about that if/once required. -- Michael
Commits
-
pg_dump: Use pg_malloc_object() and pg_malloc_array()
- 6736dea14afb 19 (unreleased) landed