Use more palloc_object() and palloc_array() in contrib/ master github/master
authorMichael Paquier <michael@paquier.xyz>
Fri, 5 Dec 2025 07:40:26 +0000 (16:40 +0900)
committerMichael Paquier <michael@paquier.xyz>
Fri, 5 Dec 2025 07:40:26 +0000 (16:40 +0900)
commit31d3847a37bec060fb4177b2fc6c0fdfc7a08011
treec93bc37750ca509c99f123dc88f320d98bec15ba
parent2f04110225ab30fbd9889d6f5d73fd6b3e1b308b
Use more palloc_object() and palloc_array() in contrib/

The idea is to encourage more the use of these new routines across the
tree, as these offer stronger type safety guarantees than palloc().  In
an ideal world, palloc() would then act as an internal routine of these
flavors, whose footprint in the tree is minimal.

The patch sent by the author is very large, and this chunk of changes
represents something like 10% of the overall patch submitted.

The code compiled is the same before and after this commit, using
objdump to do some validation with a difference taken in-between.  There
are some diffs, which are caused by changes in line numbers because some
of the new allocation formulas are shorter, for the following files:
trgm_regexp.c, xpath.c and pg_walinspect.c.

Author: David Geier <geidav.pg@gmail.com>
Discussion: https://postgr.es/m/ad0748d4-3080-436e-b0bc-ac8f86a3466a@gmail.com
67 files changed:
contrib/amcheck/verify_gin.c
contrib/amcheck/verify_heapam.c
contrib/amcheck/verify_nbtree.c
contrib/basebackup_to_shell/basebackup_to_shell.c
contrib/bloom/blinsert.c
contrib/bloom/blscan.c
contrib/bloom/blutils.c
contrib/bloom/blvacuum.c
contrib/btree_gin/btree_gin.c
contrib/btree_gist/btree_inet.c
contrib/btree_gist/btree_interval.c
contrib/btree_gist/btree_time.c
contrib/btree_gist/btree_ts.c
contrib/btree_gist/btree_utils_num.c
contrib/btree_gist/btree_utils_var.c
contrib/btree_gist/btree_uuid.c
contrib/cube/cube.c
contrib/dict_int/dict_int.c
contrib/dict_xsyn/dict_xsyn.c
contrib/file_fdw/file_fdw.c
contrib/hstore/hstore_gist.c
contrib/hstore/hstore_io.c
contrib/intarray/_int_bool.c
contrib/intarray/_int_gin.c
contrib/intarray/_int_gist.c
contrib/intarray/_intbig_gist.c
contrib/jsonb_plperl/jsonb_plperl.c
contrib/jsonb_plpython/jsonb_plpython.c
contrib/ltree/_ltree_gist.c
contrib/ltree/_ltree_op.c
contrib/ltree/ltree_gist.c
contrib/ltree/ltree_io.c
contrib/ltree/ltree_op.c
contrib/ltree/ltxtquery_io.c
contrib/pageinspect/brinfuncs.c
contrib/pageinspect/btreefuncs.c
contrib/pageinspect/ginfuncs.c
contrib/pageinspect/hashfuncs.c
contrib/pageinspect/heapfuncs.c
contrib/pg_overexplain/pg_overexplain.c
contrib/pg_trgm/trgm_gin.c
contrib/pg_trgm/trgm_gist.c
contrib/pg_trgm/trgm_regexp.c
contrib/pg_visibility/pg_visibility.c
contrib/pg_walinspect/pg_walinspect.c
contrib/pgcrypto/mbuf.c
contrib/pgcrypto/openssl.c
contrib/pgcrypto/pgp-cfb.c
contrib/pgcrypto/pgp-compress.c
contrib/pgcrypto/pgp-decrypt.c
contrib/pgcrypto/pgp-encrypt.c
contrib/pgcrypto/pgp-pgsql.c
contrib/pgcrypto/pgp-pubkey.c
contrib/pgcrypto/px-hmac.c
contrib/pgcrypto/px.c
contrib/seg/seg.c
contrib/sepgsql/label.c
contrib/sepgsql/uavc.c
contrib/spi/refint.c
contrib/sslinfo/sslinfo.c
contrib/tablefunc/tablefunc.c
contrib/test_decoding/test_decoding.c
contrib/tsm_system_rows/tsm_system_rows.c
contrib/tsm_system_time/tsm_system_time.c
contrib/unaccent/unaccent.c
contrib/xml2/xpath.c
contrib/xml2/xslt_proc.c