postgresql/src/backend/utils/adt
Tom Lane 407b50f2d4 Store GUC data in a memory context, instead of using malloc().
The only real argument for using malloc directly was that we needed
the ability to not throw error on OOM; but mcxt.c grew that feature
awhile ago.

Keeping the data in a memory context improves accountability and
debuggability --- for example, without this it's almost impossible
to detect memory leaks in the GUC code with anything less costly
than valgrind.  Moreover, the next patch in this series will add a
hash table for GUC lookup, and it'd be pretty silly to be using
palloc-dependent hash facilities alongside malloc'd storage of the
underlying data.

This is a bit invasive though, in particular causing an API break
for GUC check hooks that want to modify the GUC's value or use an
"extra" data structure.  They must now use guc_malloc() and
guc_free() instead of malloc() and free().  Failure to change
affected code will result in assertion failures or worse; but
thanks to recent effort in the mcxt infrastructure, it shouldn't
be too hard to diagnose such oversights (at least in assert-enabled
builds).

One note is that this changes ParseLongOption() to return short-lived
palloc'd not malloc'd data.  There wasn't any caller for which the
previous definition was better.

Discussion: https://postgr.es/m/2982579.1662416866@sss.pgh.pa.us
2022-10-14 12:10:48 -04:00
..
.gitignore Build all Flex files standalone 2022-09-04 12:09:01 +07:00
acl.c Change some errdetail() to errdetail_internal() 2022-09-28 17:14:53 +02:00
amutils.c Fix incorrect uses of Datum conversion macros 2022-09-05 13:30:44 +02:00
array_expanded.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
array_selfuncs.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
array_typanalyze.c Rename shadowed local variables 2022-10-05 21:01:41 +13:00
array_userfuncs.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
arrayfuncs.c Fix trim_array() for zero-dimensional array argument. 2022-07-31 13:43:17 -04:00
arraysubs.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
arrayutils.c Add construct_array_builtin, deconstruct_array_builtin 2022-07-01 11:23:15 +02:00
ascii.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
bool.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
cash.c Remove unused includes 2021-12-01 16:10:56 +01:00
char.c Change type "char"'s I/O format for non-ASCII characters. 2022-08-02 10:29:35 -04:00
cryptohashfuncs.c Improve error handling of cryptohash computations 2022-01-11 09:55:16 +09:00
date.c Fix an assortment of improper usages of string functions 2022-09-06 13:19:44 +12:00
datetime.c Store GUC data in a memory context, instead of using malloc(). 2022-10-14 12:10:48 -04:00
datum.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
dbsize.c Use C library functions instead of Abs() for int64 2022-10-10 09:01:17 +02:00
domains.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
encode.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
enum.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
expandeddatum.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
expandedrecord.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
float.c Use fabsf() instead of Abs() or fabs() where appropriate 2022-10-08 13:43:26 +02:00
format_type.c Revert SQL/JSON features 2022-09-01 17:07:14 -04:00
formatting.c Revert SQL/JSON features 2022-09-01 17:07:14 -04:00
genfile.c Support pg_read_[binary_]file (filename, missing_ok). 2022-07-29 15:38:49 -04:00
geo_ops.c Harmonize more parameter names in bulk. 2022-09-20 13:09:30 -07:00
geo_selfuncs.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
geo_spgist.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
hbafuncs.c Fix path reference when parsing pg_ident.conf for pg_ident_file_mappings 2022-07-26 15:57:31 +09:00
inet_cidr_ntop.c Avoid conflicts with library versions of inet_net_ntop() and friends. 2019-08-18 19:27:23 -04:00
inet_net_pton.c Avoid conflicts with library versions of inet_net_ntop() and friends. 2019-08-18 19:27:23 -04:00
int8.c Teach planner and executor about monotonic window funcs 2022-04-08 10:34:36 +12:00
int.c Remove pg_atoi() 2022-02-15 07:44:26 +01:00
json.c Revert SQL/JSON features 2022-09-01 17:07:14 -04:00
jsonb_gin.c Avoid using list_length() to test for empty list. 2022-08-17 11:12:35 -04:00
jsonb_op.c Add construct_array_builtin, deconstruct_array_builtin 2022-07-01 11:23:15 +02:00
jsonb_util.c Harmonize more parameter names in bulk. 2022-09-20 13:09:30 -07:00
jsonb.c Harmonize more parameter names in bulk. 2022-09-20 13:09:30 -07:00
jsonbsubs.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
jsonfuncs.c Change some errdetail() to errdetail_internal() 2022-09-28 17:14:53 +02:00
jsonpath_exec.c Harmonize more parameter names in bulk. 2022-09-20 13:09:30 -07:00
jsonpath_gram.y Suppress variable-set-but-not-used warnings from clang 15. 2022-09-20 12:04:37 -04:00
jsonpath_internal.h Build all Flex files standalone 2022-09-04 12:09:01 +07:00
jsonpath_scan.l Harmonize more lexer function parameter names. 2022-09-22 13:27:16 -07:00
jsonpath.c Revert SQL/JSON features 2022-09-01 17:07:14 -04:00
levenshtein.c Further -Wshadow=compatible-local warning fixes 2022-08-24 22:04:28 +12:00
like_match.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
like_support.c Defend against stack overrun in a few more places. 2022-08-24 13:02:19 -04:00
like.c Harmonize more parameter names in bulk. 2022-09-20 13:09:30 -07:00
lockfuncs.c Replace many MemSet calls with struct initialization 2022-07-16 08:50:49 +02:00
mac8.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
mac.c Specialize tuplesort routines for different kinds of abbreviated keys 2022-04-02 15:22:25 +07:00
Makefile Build all Flex files standalone 2022-09-04 12:09:01 +07:00
mcxtfuncs.c Create routine able to set single-call SRFs for Materialize mode 2022-03-07 10:26:29 +09:00
meson.build meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
misc.c Fix an assortment of improper usages of string functions 2022-09-06 13:19:44 +12:00
multirangetypes_selfuncs.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
multirangetypes.c Fix incorrect uses of Datum conversion macros 2022-09-05 13:30:44 +02:00
name.c Add construct_array_builtin, deconstruct_array_builtin 2022-07-01 11:23:15 +02:00
network_gist.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
network_selfuncs.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
network_spgist.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
network.c Remove configure probe for sockaddr_in6 and require AF_INET6. 2022-08-26 10:18:30 +12:00
numeric.c Remove unnecessary uses of Abs() 2022-10-07 13:29:33 +02:00
numutils.c Rename shadowed local variables 2022-10-05 21:01:41 +13:00
oid.c Rename value node fields 2022-01-14 11:26:08 +01:00
oracle_compat.c Avoid ERRCODE_INTERNAL_ERROR in oracle_compat.c functions. 2022-05-26 12:25:10 -04:00
orderedsetaggs.c Add construct_array_builtin, deconstruct_array_builtin 2022-07-01 11:23:15 +02:00
partitionfuncs.c Rename shadowed local variables 2022-10-05 21:01:41 +13:00
pg_locale.c Split up guc.c for better build speed and ease of maintenance. 2022-09-13 11:11:45 -04:00
pg_lsn.c Fix incorrect uses of Datum conversion macros 2022-09-05 13:30:44 +02:00
pg_upgrade_support.c Revert 56-bit relfilenode change and follow-up commits. 2022-09-28 09:55:28 -04:00
pgstatfuncs.c Use actual backend IDs in pg_stat_get_backend_idset() and friends. 2022-09-29 12:14:39 -04:00
pseudotypes.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
quote.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
rangetypes_gist.c Remove unnecessary uses of Abs() 2022-10-07 13:29:33 +02:00
rangetypes_selfuncs.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
rangetypes_spgist.c Fix incorrect uses of Datum conversion macros 2022-09-05 13:30:44 +02:00
rangetypes_typanalyze.c Invent qsort_interruptible(). 2022-07-12 16:30:36 -04:00
rangetypes.c Harmonize more parameter names in bulk. 2022-09-20 13:09:30 -07:00
regexp.c Consistently use named parameters in regex code. 2022-09-19 15:10:24 -07:00
regproc.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
ri_triggers.c Harmonize more parameter names in bulk. 2022-09-20 13:09:30 -07:00
rowtypes.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
ruleutils.c Rename shadowed local variables 2022-10-05 21:01:41 +13:00
selfuncs.c Remove unnecessary uses of Abs() 2022-10-07 13:29:33 +02:00
tid.c Tighten overflow checks in tidin(). 2022-03-03 20:04:35 -05:00
timestamp.c Remove unnecessary uses of Abs() 2022-10-07 13:29:33 +02:00
trigfuncs.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
tsginidx.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
tsgistidx.c Remove unnecessary uses of Abs() 2022-10-07 13:29:33 +02:00
tsquery_cleanup.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
tsquery_gist.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
tsquery_op.c Fix incorrect uses of Datum conversion macros 2022-09-05 13:30:44 +02:00
tsquery_rewrite.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
tsquery_util.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
tsquery.c Introduce t_isalnum() to replace t_isalpha() || t_isdigit() tests. 2022-10-06 11:08:56 -04:00
tsrank.c Remove unnecessary uses of Abs() 2022-10-07 13:29:33 +02:00
tsvector_op.c Add construct_array_builtin, deconstruct_array_builtin 2022-07-01 11:23:15 +02:00
tsvector_parser.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
tsvector.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
uuid.c Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
varbit.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
varchar.c Split up guc.c for better build speed and ease of maintenance. 2022-09-13 11:11:45 -04:00
varlena.c Adjust assorted hint messages that list all valid options. 2022-09-16 14:53:12 +02:00
version.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
windowfuncs.c Teach planner and executor about monotonic window funcs 2022-04-08 10:34:36 +12:00
xid8funcs.c Fix visibility check when XID is committed in CLOG but not in procarray. 2022-06-27 08:21:08 +03:00
xid.c Add min() and max() aggregates for xid8. 2022-02-10 12:33:41 +09:00
xml.c Harmonize more parameter names in bulk. 2022-09-20 13:09:30 -07:00