postgresql/src/include/common
Peter Eisentraut 7dd9b469bc Expand palloc/pg_malloc API for more type safety
This adds additional variants of palloc, pg_malloc, etc. that
encapsulate common usage patterns and provide more type safety.

Specifically, this adds palloc_object(), palloc_array(), and
repalloc_array(), which take the type name of the object to be
allocated as its first argument and cast the return as a pointer to
that type.  There are also palloc0_object() and palloc0_array()
variants for initializing with zero, and pg_malloc_*() variants of all
of the above.

Inspired by the talloc library.

This is backpatched from master so that future backpatchable code can
make use of these APIs.  This patch by itself does not contain any
users of these APIs.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/bb755632-2a43-d523-36f8-a1e7a389a907@enterprisedb.com
2022-09-14 06:08:51 +02:00
..
base64.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
config_info.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
connect.h Move connect.h from fe_utils to src/include/common. 2020-08-10 09:22:58 -07:00
controldata_utils.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
fe_memutils.h Expand palloc/pg_malloc API for more type safety 2022-09-14 06:08:51 +02:00
file_perm.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
file_utils.h Initial pgindent run for v12. 2019-05-22 12:55:34 -04:00
int.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
int128.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
ip.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
keywords.h Replace the data structure used for keyword lookup. 2019-01-06 17:02:57 -05:00
kwlookup.h Use perfect hashing, instead of binary search, for keyword lookup. 2019-01-09 19:47:46 -05:00
link-canary.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
logging.h Initial pgindent run for v12. 2019-05-22 12:55:34 -04:00
md5.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
pg_lzcompress.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
relpath.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
restricted_token.h Unified logging system for command-line programs 2019-04-01 20:01:35 +02:00
saslprep.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
scram-common.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
sha2.h Use OpenSSL-specific ifdefs in sha2.h 2019-06-14 09:00:36 +09:00
shortest_dec.h Change floating-point output format for improved performance. 2019-02-13 15:20:33 +00:00
string.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
unicode_norm.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
unicode_norm_table.h Update unicode_norm_table.h to Unicode 12.1.0 2019-06-24 22:50:56 +02:00
username.h Update copyright for 2019 2019-01-02 12:44:25 -05:00