summaryrefslogtreecommitdiff
path: root/src/backend/utils
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2018-10-12 14:26:56 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2018-10-12 14:26:56 -0400
commit3d059655be7dfcb7124c6b3ce0925448de89f669 (patch)
tree5fb279bb5e4182fcb92af0aaea91f4dba329c6f2 /src/backend/utils
parent355684ee3fa3001adf0de3873fddadd119773819 (diff)
Simplify use of AllocSetContextCreate() wrapper macro.
We can allow this macro to accept either abbreviated or non-abbreviated allocation parameters by making use of __VA_ARGS__. As noted by Andres Freund, it's unlikely that any compiler would have __builtin_constant_p but not __VA_ARGS__, so this gives up little or no error checking, and it avoids a minor but annoying API break for extensions. With this change, there is no reason for anybody to call AllocSetContextCreateExtended directly, so in HEAD I renamed it to AllocSetContextCreateInternal. It's probably too late for an ABI break like that in 11, though. Discussion: https://postgr.es/m/20181012170355.bhxi273skjt6sag4@alap3.anarazel.de
Diffstat (limited to 'src/backend/utils')
-rw-r--r--src/backend/utils/mmgr/aset.c6
-rw-r--r--src/backend/utils/mmgr/mcxt.c10
2 files changed, 9 insertions, 7 deletions
diff --git a/src/backend/utils/mmgr/aset.c b/src/backend/utils/mmgr/aset.c
index e3d2c4e2faa..c4d7a499b15 100644
--- a/src/backend/utils/mmgr/aset.c
+++ b/src/backend/utils/mmgr/aset.c
@@ -381,8 +381,10 @@ AllocSetFreeIndex(Size size)
* maxBlockSize: maximum allocation block size
*
* Most callers should abstract the context size parameters using a macro
- * such as ALLOCSET_DEFAULT_SIZES. (This is now *required* when going
- * through the AllocSetContextCreate macro.)
+ * such as ALLOCSET_DEFAULT_SIZES.
+ *
+ * Note: don't call this directly; go through the wrapper macro
+ * AllocSetContextCreate.
*/
MemoryContext
AllocSetContextCreateExtended(MemoryContext parent,
diff --git a/src/backend/utils/mmgr/mcxt.c b/src/backend/utils/mmgr/mcxt.c
index ebe0342f18e..22da98c19d9 100644
--- a/src/backend/utils/mmgr/mcxt.c
+++ b/src/backend/utils/mmgr/mcxt.c
@@ -119,11 +119,11 @@ MemoryContextInit(void)
* This should be the last step in this function, as elog.c assumes memory
* management works once ErrorContext is non-null.
*/
- ErrorContext = AllocSetContextCreateExtended(TopMemoryContext,
- "ErrorContext",
- 8 * 1024,
- 8 * 1024,
- 8 * 1024);
+ ErrorContext = AllocSetContextCreate(TopMemoryContext,
+ "ErrorContext",
+ 8 * 1024,
+ 8 * 1024,
+ 8 * 1024);
MemoryContextAllowInCriticalSection(ErrorContext, true);
}