*/
if (TransactionAbortContext == NULL)
TransactionAbortContext =
- AllocSetContextCreateExtended(TopMemoryContext,
- "TransactionAbortContext",
- 32 * 1024,
- 32 * 1024,
- 32 * 1024);
+ AllocSetContextCreate(TopMemoryContext,
+ "TransactionAbortContext",
+ 32 * 1024,
+ 32 * 1024,
+ 32 * 1024);
/*
* We shouldn't have a transaction context already.
* 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,
* 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);
}
/*
* This wrapper macro exists to check for non-constant strings used as context
* names; that's no longer supported. (Use MemoryContextSetIdentifier if you
- * want to provide a variable identifier.) Note you must specify block sizes
- * with one of the abstraction macros below.
+ * want to provide a variable identifier.)
*/
-#ifdef HAVE__BUILTIN_CONSTANT_P
-#define AllocSetContextCreate(parent, name, allocparams) \
+#if defined(HAVE__BUILTIN_CONSTANT_P) && defined(HAVE__VA_ARGS)
+#define AllocSetContextCreate(parent, name, ...) \
(StaticAssertExpr(__builtin_constant_p(name), \
"memory context names must be constant strings"), \
- AllocSetContextCreateExtended(parent, name, allocparams))
+ AllocSetContextCreateExtended(parent, name, __VA_ARGS__))
#else
-#define AllocSetContextCreate(parent, name, allocparams) \
- AllocSetContextCreateExtended(parent, name, allocparams)
+#define AllocSetContextCreate \
+ AllocSetContextCreateExtended
#endif
/* slab.c */