mirror of
https://github.com/postgres/postgres.git
synced 2026-01-05 23:38:41 +03:00
Remove AssertArg and AssertState
These don't offer anything over plain Assert, and their usage had already been declared obsolescent. Author: Nathan Bossart <nathandbossart@gmail.com> Reviewed-by: Michael Paquier <michael@paquier.xyz> Discussion: https://www.postgresql.org/message-id/20221009210148.GA900071@nathanxps13
This commit is contained in:
@@ -785,7 +785,7 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, Oid objoid)
|
||||
|
||||
/* should be called from backends */
|
||||
Assert(IsUnderPostmaster || !IsPostmasterEnvironment);
|
||||
AssertArg(!kind_info->fixed_amount);
|
||||
Assert(!kind_info->fixed_amount);
|
||||
|
||||
pgstat_prep_snapshot();
|
||||
|
||||
@@ -901,8 +901,8 @@ pgstat_have_entry(PgStat_Kind kind, Oid dboid, Oid objoid)
|
||||
void
|
||||
pgstat_snapshot_fixed(PgStat_Kind kind)
|
||||
{
|
||||
AssertArg(pgstat_is_kind_valid(kind));
|
||||
AssertArg(pgstat_get_kind_info(kind)->fixed_amount);
|
||||
Assert(pgstat_is_kind_valid(kind));
|
||||
Assert(pgstat_get_kind_info(kind)->fixed_amount);
|
||||
|
||||
if (pgstat_fetch_consistency == PGSTAT_FETCH_CONSISTENCY_SNAPSHOT)
|
||||
pgstat_build_snapshot();
|
||||
@@ -1219,7 +1219,7 @@ pgstat_is_kind_valid(int ikind)
|
||||
const PgStat_KindInfo *
|
||||
pgstat_get_kind_info(PgStat_Kind kind)
|
||||
{
|
||||
AssertArg(pgstat_is_kind_valid(kind));
|
||||
Assert(pgstat_is_kind_valid(kind));
|
||||
|
||||
return &pgstat_kind_infos[kind];
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ pgstat_reset_replslot(const char *name)
|
||||
{
|
||||
ReplicationSlot *slot;
|
||||
|
||||
AssertArg(name != NULL);
|
||||
Assert(name != NULL);
|
||||
|
||||
/* Check if the slot exits with the given name. */
|
||||
slot = SearchNamedReplicationSlot(name, true);
|
||||
@@ -213,7 +213,7 @@ get_replslot_index(const char *name)
|
||||
{
|
||||
ReplicationSlot *slot;
|
||||
|
||||
AssertArg(name != NULL);
|
||||
Assert(name != NULL);
|
||||
|
||||
slot = SearchNamedReplicationSlot(name, true);
|
||||
|
||||
|
||||
@@ -402,7 +402,7 @@ pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, Oid objoid, bool create,
|
||||
* passing in created_entry only makes sense if we possibly could create
|
||||
* entry.
|
||||
*/
|
||||
AssertArg(create || created_entry == NULL);
|
||||
Assert(create || created_entry == NULL);
|
||||
pgstat_assert_is_up();
|
||||
Assert(pgStatLocal.shared_hash != NULL);
|
||||
Assert(!pgStatLocal.shmem->is_shutdown);
|
||||
|
||||
@@ -46,7 +46,7 @@ pgstat_reset_slru(const char *name)
|
||||
{
|
||||
TimestampTz ts = GetCurrentTimestamp();
|
||||
|
||||
AssertArg(name != NULL);
|
||||
Assert(name != NULL);
|
||||
|
||||
pgstat_reset_slru_counter_internal(pgstat_get_slru_index(name), ts);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ PutMemoryContextsStatsTupleStore(Tuplestorestate *tupstore,
|
||||
const char *name;
|
||||
const char *ident;
|
||||
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
Assert(MemoryContextIsValid(context));
|
||||
|
||||
name = context->name;
|
||||
ident = context->ident;
|
||||
|
||||
@@ -4500,7 +4500,7 @@ XmlTableSetColumnFilter(TableFuncScanState *state, const char *path, int colnum)
|
||||
XmlTableBuilderData *xtCxt;
|
||||
xmlChar *xstr;
|
||||
|
||||
AssertArg(PointerIsValid(path));
|
||||
Assert(PointerIsValid(path));
|
||||
|
||||
xtCxt = GetXmlTableBuilderPrivateData(state, "XmlTableSetColumnFilter");
|
||||
|
||||
|
||||
2
src/backend/utils/cache/relcache.c
vendored
2
src/backend/utils/cache/relcache.c
vendored
@@ -3474,7 +3474,7 @@ RelationBuildLocalRelation(const char *relname,
|
||||
bool has_not_null;
|
||||
bool nailit;
|
||||
|
||||
AssertArg(natts >= 0);
|
||||
Assert(natts >= 0);
|
||||
|
||||
/*
|
||||
* check for creation of a rel that must be nailed in cache.
|
||||
|
||||
@@ -405,7 +405,7 @@ file_exists(const char *name)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
AssertArg(name != NULL);
|
||||
Assert(name != NULL);
|
||||
|
||||
if (stat(name, &st) == 0)
|
||||
return !S_ISDIR(st.st_mode);
|
||||
@@ -434,7 +434,7 @@ expand_dynamic_library_name(const char *name)
|
||||
char *new;
|
||||
char *full;
|
||||
|
||||
AssertArg(name);
|
||||
Assert(name);
|
||||
|
||||
have_slash = (first_dir_separator(name) != NULL);
|
||||
|
||||
@@ -502,7 +502,7 @@ substitute_libpath_macro(const char *name)
|
||||
{
|
||||
const char *sep_ptr;
|
||||
|
||||
AssertArg(name != NULL);
|
||||
Assert(name != NULL);
|
||||
|
||||
/* Currently, we only recognize $libdir at the start of the string */
|
||||
if (name[0] != '$')
|
||||
@@ -534,9 +534,9 @@ find_in_dynamic_libpath(const char *basename)
|
||||
const char *p;
|
||||
size_t baselen;
|
||||
|
||||
AssertArg(basename != NULL);
|
||||
AssertArg(first_dir_separator(basename) == NULL);
|
||||
AssertState(Dynamic_library_path != NULL);
|
||||
Assert(basename != NULL);
|
||||
Assert(first_dir_separator(basename) == NULL);
|
||||
Assert(Dynamic_library_path != NULL);
|
||||
|
||||
p = Dynamic_library_path;
|
||||
if (strlen(p) == 0)
|
||||
|
||||
@@ -417,7 +417,7 @@ SetDataDir(const char *dir)
|
||||
{
|
||||
char *new;
|
||||
|
||||
AssertArg(dir);
|
||||
Assert(dir);
|
||||
|
||||
/* If presented path is relative, convert to absolute */
|
||||
new = make_absolute_path(dir);
|
||||
@@ -435,7 +435,7 @@ SetDataDir(const char *dir)
|
||||
void
|
||||
ChangeToDataDir(void)
|
||||
{
|
||||
AssertState(DataDir);
|
||||
Assert(DataDir);
|
||||
|
||||
if (chdir(DataDir) < 0)
|
||||
ereport(FATAL,
|
||||
@@ -496,7 +496,7 @@ static bool SetRoleIsActive = false;
|
||||
Oid
|
||||
GetUserId(void)
|
||||
{
|
||||
AssertState(OidIsValid(CurrentUserId));
|
||||
Assert(OidIsValid(CurrentUserId));
|
||||
return CurrentUserId;
|
||||
}
|
||||
|
||||
@@ -507,7 +507,7 @@ GetUserId(void)
|
||||
Oid
|
||||
GetOuterUserId(void)
|
||||
{
|
||||
AssertState(OidIsValid(OuterUserId));
|
||||
Assert(OidIsValid(OuterUserId));
|
||||
return OuterUserId;
|
||||
}
|
||||
|
||||
@@ -515,8 +515,8 @@ GetOuterUserId(void)
|
||||
static void
|
||||
SetOuterUserId(Oid userid)
|
||||
{
|
||||
AssertState(SecurityRestrictionContext == 0);
|
||||
AssertArg(OidIsValid(userid));
|
||||
Assert(SecurityRestrictionContext == 0);
|
||||
Assert(OidIsValid(userid));
|
||||
OuterUserId = userid;
|
||||
|
||||
/* We force the effective user ID to match, too */
|
||||
@@ -530,7 +530,7 @@ SetOuterUserId(Oid userid)
|
||||
Oid
|
||||
GetSessionUserId(void)
|
||||
{
|
||||
AssertState(OidIsValid(SessionUserId));
|
||||
Assert(OidIsValid(SessionUserId));
|
||||
return SessionUserId;
|
||||
}
|
||||
|
||||
@@ -538,8 +538,8 @@ GetSessionUserId(void)
|
||||
static void
|
||||
SetSessionUserId(Oid userid, bool is_superuser)
|
||||
{
|
||||
AssertState(SecurityRestrictionContext == 0);
|
||||
AssertArg(OidIsValid(userid));
|
||||
Assert(SecurityRestrictionContext == 0);
|
||||
Assert(OidIsValid(userid));
|
||||
SessionUserId = userid;
|
||||
SessionUserIsSuperuser = is_superuser;
|
||||
SetRoleIsActive = false;
|
||||
@@ -565,7 +565,7 @@ GetSystemUser(void)
|
||||
Oid
|
||||
GetAuthenticatedUserId(void)
|
||||
{
|
||||
AssertState(OidIsValid(AuthenticatedUserId));
|
||||
Assert(OidIsValid(AuthenticatedUserId));
|
||||
return AuthenticatedUserId;
|
||||
}
|
||||
|
||||
@@ -719,10 +719,10 @@ InitializeSessionUserId(const char *rolename, Oid roleid)
|
||||
* Don't do scans if we're bootstrapping, none of the system catalogs
|
||||
* exist yet, and they should be owned by postgres anyway.
|
||||
*/
|
||||
AssertState(!IsBootstrapProcessingMode());
|
||||
Assert(!IsBootstrapProcessingMode());
|
||||
|
||||
/* call only once */
|
||||
AssertState(!OidIsValid(AuthenticatedUserId));
|
||||
Assert(!OidIsValid(AuthenticatedUserId));
|
||||
|
||||
/*
|
||||
* Make sure syscache entries are flushed for recent catalog changes. This
|
||||
@@ -818,10 +818,10 @@ InitializeSessionUserIdStandalone(void)
|
||||
* This function should only be called in single-user mode, in autovacuum
|
||||
* workers, and in background workers.
|
||||
*/
|
||||
AssertState(!IsUnderPostmaster || IsAutoVacuumWorkerProcess() || IsBackgroundWorker);
|
||||
Assert(!IsUnderPostmaster || IsAutoVacuumWorkerProcess() || IsBackgroundWorker);
|
||||
|
||||
/* call only once */
|
||||
AssertState(!OidIsValid(AuthenticatedUserId));
|
||||
Assert(!OidIsValid(AuthenticatedUserId));
|
||||
|
||||
AuthenticatedUserId = BOOTSTRAP_SUPERUSERID;
|
||||
AuthenticatedUserIsSuperuser = true;
|
||||
@@ -886,7 +886,7 @@ void
|
||||
SetSessionAuthorization(Oid userid, bool is_superuser)
|
||||
{
|
||||
/* Must have authenticated already, else can't make permission check */
|
||||
AssertState(OidIsValid(AuthenticatedUserId));
|
||||
Assert(OidIsValid(AuthenticatedUserId));
|
||||
|
||||
if (userid != AuthenticatedUserId &&
|
||||
!AuthenticatedUserIsSuperuser)
|
||||
|
||||
@@ -179,7 +179,7 @@ AbsoluteConfigLocation(const char *location, const char *calling_file)
|
||||
}
|
||||
else
|
||||
{
|
||||
AssertState(DataDir);
|
||||
Assert(DataDir);
|
||||
join_path_components(abs_path, DataDir, location);
|
||||
canonicalize_path(abs_path);
|
||||
}
|
||||
|
||||
@@ -6081,9 +6081,9 @@ ParseLongOption(const char *string, char **name, char **value)
|
||||
size_t equal_pos;
|
||||
char *cp;
|
||||
|
||||
AssertArg(string);
|
||||
AssertArg(name);
|
||||
AssertArg(value);
|
||||
Assert(string);
|
||||
Assert(name);
|
||||
Assert(value);
|
||||
|
||||
equal_pos = strcspn(string, "=");
|
||||
|
||||
|
||||
@@ -544,7 +544,7 @@ AllocSetReset(MemoryContext context)
|
||||
AllocBlock block;
|
||||
Size keepersize PG_USED_FOR_ASSERTS_ONLY;
|
||||
|
||||
AssertArg(AllocSetIsValid(set));
|
||||
Assert(AllocSetIsValid(set));
|
||||
|
||||
#ifdef MEMORY_CONTEXT_CHECKING
|
||||
/* Check for corruption and leaks before freeing */
|
||||
@@ -614,7 +614,7 @@ AllocSetDelete(MemoryContext context)
|
||||
AllocBlock block = set->blocks;
|
||||
Size keepersize PG_USED_FOR_ASSERTS_ONLY;
|
||||
|
||||
AssertArg(AllocSetIsValid(set));
|
||||
Assert(AllocSetIsValid(set));
|
||||
|
||||
#ifdef MEMORY_CONTEXT_CHECKING
|
||||
/* Check for corruption and leaks before freeing */
|
||||
@@ -713,7 +713,7 @@ AllocSetAlloc(MemoryContext context, Size size)
|
||||
Size chunk_size;
|
||||
Size blksize;
|
||||
|
||||
AssertArg(AllocSetIsValid(set));
|
||||
Assert(AllocSetIsValid(set));
|
||||
|
||||
/*
|
||||
* If requested size exceeds maximum for chunks, allocate an entire block
|
||||
@@ -1061,7 +1061,7 @@ AllocSetFree(void *pointer)
|
||||
* Future field experience may show that these Asserts had better
|
||||
* become regular runtime test-and-elog checks.
|
||||
*/
|
||||
AssertArg(AllocBlockIsValid(block));
|
||||
Assert(AllocBlockIsValid(block));
|
||||
set = block->aset;
|
||||
|
||||
fidx = MemoryChunkGetValue(chunk);
|
||||
@@ -1237,7 +1237,7 @@ AllocSetRealloc(void *pointer, Size size)
|
||||
* field experience may show that these Asserts had better become regular
|
||||
* runtime test-and-elog checks.
|
||||
*/
|
||||
AssertArg(AllocBlockIsValid(block));
|
||||
Assert(AllocBlockIsValid(block));
|
||||
set = block->aset;
|
||||
|
||||
fidx = MemoryChunkGetValue(chunk);
|
||||
@@ -1368,7 +1368,7 @@ AllocSetGetChunkContext(void *pointer)
|
||||
else
|
||||
block = (AllocBlock) MemoryChunkGetBlock(chunk);
|
||||
|
||||
AssertArg(AllocBlockIsValid(block));
|
||||
Assert(AllocBlockIsValid(block));
|
||||
set = block->aset;
|
||||
|
||||
return &set->header;
|
||||
@@ -1389,7 +1389,7 @@ AllocSetGetChunkSpace(void *pointer)
|
||||
{
|
||||
AllocBlock block = ExternalChunkGetBlock(chunk);
|
||||
|
||||
AssertArg(AllocBlockIsValid(block));
|
||||
Assert(AllocBlockIsValid(block));
|
||||
return block->endptr - (char *) chunk;
|
||||
}
|
||||
|
||||
@@ -1405,7 +1405,7 @@ AllocSetGetChunkSpace(void *pointer)
|
||||
bool
|
||||
AllocSetIsEmpty(MemoryContext context)
|
||||
{
|
||||
AssertArg(AllocSetIsValid(context));
|
||||
Assert(AllocSetIsValid(context));
|
||||
|
||||
/*
|
||||
* For now, we say "empty" only if the context is new or just reset. We
|
||||
@@ -1440,7 +1440,7 @@ AllocSetStats(MemoryContext context,
|
||||
AllocBlock block;
|
||||
int fidx;
|
||||
|
||||
AssertArg(AllocSetIsValid(set));
|
||||
Assert(AllocSetIsValid(set));
|
||||
|
||||
/* Include context header in totalspace */
|
||||
totalspace = MAXALIGN(sizeof(AllocSetContext));
|
||||
|
||||
@@ -284,7 +284,7 @@ GenerationReset(MemoryContext context)
|
||||
GenerationContext *set = (GenerationContext *) context;
|
||||
dlist_mutable_iter miter;
|
||||
|
||||
AssertArg(GenerationIsValid(set));
|
||||
Assert(GenerationIsValid(set));
|
||||
|
||||
#ifdef MEMORY_CONTEXT_CHECKING
|
||||
/* Check for corruption and leaks before freeing */
|
||||
@@ -354,7 +354,7 @@ GenerationAlloc(MemoryContext context, Size size)
|
||||
Size chunk_size;
|
||||
Size required_size;
|
||||
|
||||
AssertArg(GenerationIsValid(set));
|
||||
Assert(GenerationIsValid(set));
|
||||
|
||||
#ifdef MEMORY_CONTEXT_CHECKING
|
||||
/* ensure there's always space for the sentinel byte */
|
||||
@@ -657,7 +657,7 @@ GenerationFree(void *pointer)
|
||||
* block is good. Future field experience may show that this Assert
|
||||
* had better become a regular runtime test-and-elog check.
|
||||
*/
|
||||
AssertArg(GenerationBlockIsValid(block));
|
||||
Assert(GenerationBlockIsValid(block));
|
||||
|
||||
#if defined(MEMORY_CONTEXT_CHECKING) || defined(CLOBBER_FREED_MEMORY)
|
||||
chunksize = MemoryChunkGetValue(chunk);
|
||||
@@ -769,7 +769,7 @@ GenerationRealloc(void *pointer, Size size)
|
||||
* block is good. Future field experience may show that this Assert
|
||||
* had better become a regular runtime test-and-elog check.
|
||||
*/
|
||||
AssertArg(GenerationBlockIsValid(block));
|
||||
Assert(GenerationBlockIsValid(block));
|
||||
|
||||
oldsize = MemoryChunkGetValue(chunk);
|
||||
}
|
||||
@@ -888,7 +888,7 @@ GenerationGetChunkContext(void *pointer)
|
||||
else
|
||||
block = (GenerationBlock *) MemoryChunkGetBlock(chunk);
|
||||
|
||||
AssertArg(GenerationBlockIsValid(block));
|
||||
Assert(GenerationBlockIsValid(block));
|
||||
return &block->context->header;
|
||||
}
|
||||
|
||||
@@ -907,7 +907,7 @@ GenerationGetChunkSpace(void *pointer)
|
||||
{
|
||||
GenerationBlock *block = ExternalChunkGetBlock(chunk);
|
||||
|
||||
AssertArg(GenerationBlockIsValid(block));
|
||||
Assert(GenerationBlockIsValid(block));
|
||||
chunksize = block->endptr - (char *) pointer;
|
||||
}
|
||||
else
|
||||
@@ -926,7 +926,7 @@ GenerationIsEmpty(MemoryContext context)
|
||||
GenerationContext *set = (GenerationContext *) context;
|
||||
dlist_iter iter;
|
||||
|
||||
AssertArg(GenerationIsValid(set));
|
||||
Assert(GenerationIsValid(set));
|
||||
|
||||
dlist_foreach(iter, &set->blocks)
|
||||
{
|
||||
@@ -964,7 +964,7 @@ GenerationStats(MemoryContext context,
|
||||
Size freespace = 0;
|
||||
dlist_iter iter;
|
||||
|
||||
AssertArg(GenerationIsValid(set));
|
||||
Assert(GenerationIsValid(set));
|
||||
|
||||
/* Include context header in totalspace */
|
||||
totalspace = MAXALIGN(sizeof(GenerationContext));
|
||||
|
||||
@@ -258,7 +258,7 @@ BogusGetChunkSpace(void *pointer)
|
||||
void
|
||||
MemoryContextInit(void)
|
||||
{
|
||||
AssertState(TopMemoryContext == NULL);
|
||||
Assert(TopMemoryContext == NULL);
|
||||
|
||||
/*
|
||||
* First, initialize TopMemoryContext, which is the parent of all others.
|
||||
@@ -302,7 +302,7 @@ MemoryContextInit(void)
|
||||
void
|
||||
MemoryContextReset(MemoryContext context)
|
||||
{
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
Assert(MemoryContextIsValid(context));
|
||||
|
||||
/* save a function call in common case where there are no children */
|
||||
if (context->firstchild != NULL)
|
||||
@@ -321,7 +321,7 @@ MemoryContextReset(MemoryContext context)
|
||||
void
|
||||
MemoryContextResetOnly(MemoryContext context)
|
||||
{
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
Assert(MemoryContextIsValid(context));
|
||||
|
||||
/* Nothing to do if no pallocs since startup or last reset */
|
||||
if (!context->isReset)
|
||||
@@ -354,7 +354,7 @@ MemoryContextResetChildren(MemoryContext context)
|
||||
{
|
||||
MemoryContext child;
|
||||
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
Assert(MemoryContextIsValid(context));
|
||||
|
||||
for (child = context->firstchild; child != NULL; child = child->nextchild)
|
||||
{
|
||||
@@ -375,7 +375,7 @@ MemoryContextResetChildren(MemoryContext context)
|
||||
void
|
||||
MemoryContextDelete(MemoryContext context)
|
||||
{
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
Assert(MemoryContextIsValid(context));
|
||||
/* We had better not be deleting TopMemoryContext ... */
|
||||
Assert(context != TopMemoryContext);
|
||||
/* And not CurrentMemoryContext, either */
|
||||
@@ -420,7 +420,7 @@ MemoryContextDelete(MemoryContext context)
|
||||
void
|
||||
MemoryContextDeleteChildren(MemoryContext context)
|
||||
{
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
Assert(MemoryContextIsValid(context));
|
||||
|
||||
/*
|
||||
* MemoryContextDelete will delink the child from me, so just iterate as
|
||||
@@ -450,7 +450,7 @@ void
|
||||
MemoryContextRegisterResetCallback(MemoryContext context,
|
||||
MemoryContextCallback *cb)
|
||||
{
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
Assert(MemoryContextIsValid(context));
|
||||
|
||||
/* Push onto head so this will be called before older registrants. */
|
||||
cb->next = context->reset_cbs;
|
||||
@@ -493,7 +493,7 @@ MemoryContextCallResetCallbacks(MemoryContext context)
|
||||
void
|
||||
MemoryContextSetIdentifier(MemoryContext context, const char *id)
|
||||
{
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
Assert(MemoryContextIsValid(context));
|
||||
context->ident = id;
|
||||
}
|
||||
|
||||
@@ -518,8 +518,8 @@ MemoryContextSetIdentifier(MemoryContext context, const char *id)
|
||||
void
|
||||
MemoryContextSetParent(MemoryContext context, MemoryContext new_parent)
|
||||
{
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
AssertArg(context != new_parent);
|
||||
Assert(MemoryContextIsValid(context));
|
||||
Assert(context != new_parent);
|
||||
|
||||
/* Fast path if it's got correct parent already */
|
||||
if (new_parent == context->parent)
|
||||
@@ -545,7 +545,7 @@ MemoryContextSetParent(MemoryContext context, MemoryContext new_parent)
|
||||
/* And relink */
|
||||
if (new_parent)
|
||||
{
|
||||
AssertArg(MemoryContextIsValid(new_parent));
|
||||
Assert(MemoryContextIsValid(new_parent));
|
||||
context->parent = new_parent;
|
||||
context->prevchild = NULL;
|
||||
context->nextchild = new_parent->firstchild;
|
||||
@@ -575,7 +575,7 @@ MemoryContextSetParent(MemoryContext context, MemoryContext new_parent)
|
||||
void
|
||||
MemoryContextAllowInCriticalSection(MemoryContext context, bool allow)
|
||||
{
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
Assert(MemoryContextIsValid(context));
|
||||
|
||||
context->allowInCritSection = allow;
|
||||
}
|
||||
@@ -612,7 +612,7 @@ GetMemoryChunkSpace(void *pointer)
|
||||
MemoryContext
|
||||
MemoryContextGetParent(MemoryContext context)
|
||||
{
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
Assert(MemoryContextIsValid(context));
|
||||
|
||||
return context->parent;
|
||||
}
|
||||
@@ -624,7 +624,7 @@ MemoryContextGetParent(MemoryContext context)
|
||||
bool
|
||||
MemoryContextIsEmpty(MemoryContext context)
|
||||
{
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
Assert(MemoryContextIsValid(context));
|
||||
|
||||
/*
|
||||
* For now, we consider a memory context nonempty if it has any children;
|
||||
@@ -645,7 +645,7 @@ MemoryContextMemAllocated(MemoryContext context, bool recurse)
|
||||
{
|
||||
Size total = context->mem_allocated;
|
||||
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
Assert(MemoryContextIsValid(context));
|
||||
|
||||
if (recurse)
|
||||
{
|
||||
@@ -737,7 +737,7 @@ MemoryContextStatsInternal(MemoryContext context, int level,
|
||||
MemoryContext child;
|
||||
int ichild;
|
||||
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
Assert(MemoryContextIsValid(context));
|
||||
|
||||
/* Examine the context itself */
|
||||
context->methods->stats(context,
|
||||
@@ -902,7 +902,7 @@ MemoryContextCheck(MemoryContext context)
|
||||
{
|
||||
MemoryContext child;
|
||||
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
Assert(MemoryContextIsValid(context));
|
||||
|
||||
context->methods->check(context);
|
||||
for (child = context->firstchild; child != NULL; child = child->nextchild)
|
||||
@@ -995,7 +995,7 @@ MemoryContextAlloc(MemoryContext context, Size size)
|
||||
{
|
||||
void *ret;
|
||||
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
Assert(MemoryContextIsValid(context));
|
||||
AssertNotInCriticalSection(context);
|
||||
|
||||
if (!AllocSizeIsValid(size))
|
||||
@@ -1038,7 +1038,7 @@ MemoryContextAllocZero(MemoryContext context, Size size)
|
||||
{
|
||||
void *ret;
|
||||
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
Assert(MemoryContextIsValid(context));
|
||||
AssertNotInCriticalSection(context);
|
||||
|
||||
if (!AllocSizeIsValid(size))
|
||||
@@ -1076,7 +1076,7 @@ MemoryContextAllocZeroAligned(MemoryContext context, Size size)
|
||||
{
|
||||
void *ret;
|
||||
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
Assert(MemoryContextIsValid(context));
|
||||
AssertNotInCriticalSection(context);
|
||||
|
||||
if (!AllocSizeIsValid(size))
|
||||
@@ -1111,7 +1111,7 @@ MemoryContextAllocExtended(MemoryContext context, Size size, int flags)
|
||||
{
|
||||
void *ret;
|
||||
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
Assert(MemoryContextIsValid(context));
|
||||
AssertNotInCriticalSection(context);
|
||||
|
||||
if (!((flags & MCXT_ALLOC_HUGE) != 0 ? AllocHugeSizeIsValid(size) :
|
||||
@@ -1202,7 +1202,7 @@ palloc(Size size)
|
||||
void *ret;
|
||||
MemoryContext context = CurrentMemoryContext;
|
||||
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
Assert(MemoryContextIsValid(context));
|
||||
AssertNotInCriticalSection(context);
|
||||
|
||||
if (!AllocSizeIsValid(size))
|
||||
@@ -1233,7 +1233,7 @@ palloc0(Size size)
|
||||
void *ret;
|
||||
MemoryContext context = CurrentMemoryContext;
|
||||
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
Assert(MemoryContextIsValid(context));
|
||||
AssertNotInCriticalSection(context);
|
||||
|
||||
if (!AllocSizeIsValid(size))
|
||||
@@ -1266,7 +1266,7 @@ palloc_extended(Size size, int flags)
|
||||
void *ret;
|
||||
MemoryContext context = CurrentMemoryContext;
|
||||
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
Assert(MemoryContextIsValid(context));
|
||||
AssertNotInCriticalSection(context);
|
||||
|
||||
if (!((flags & MCXT_ALLOC_HUGE) != 0 ? AllocHugeSizeIsValid(size) :
|
||||
@@ -1406,7 +1406,7 @@ MemoryContextAllocHuge(MemoryContext context, Size size)
|
||||
{
|
||||
void *ret;
|
||||
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
Assert(MemoryContextIsValid(context));
|
||||
AssertNotInCriticalSection(context);
|
||||
|
||||
if (!AllocHugeSizeIsValid(size))
|
||||
|
||||
@@ -177,7 +177,7 @@ CreatePortal(const char *name, bool allowDup, bool dupSilent)
|
||||
{
|
||||
Portal portal;
|
||||
|
||||
AssertArg(PointerIsValid(name));
|
||||
Assert(PointerIsValid(name));
|
||||
|
||||
portal = GetPortalByName(name);
|
||||
if (PortalIsValid(portal))
|
||||
@@ -287,11 +287,11 @@ PortalDefineQuery(Portal portal,
|
||||
List *stmts,
|
||||
CachedPlan *cplan)
|
||||
{
|
||||
AssertArg(PortalIsValid(portal));
|
||||
AssertState(portal->status == PORTAL_NEW);
|
||||
Assert(PortalIsValid(portal));
|
||||
Assert(portal->status == PORTAL_NEW);
|
||||
|
||||
AssertArg(sourceText != NULL);
|
||||
AssertArg(commandTag != CMDTAG_UNKNOWN || stmts == NIL);
|
||||
Assert(sourceText != NULL);
|
||||
Assert(commandTag != CMDTAG_UNKNOWN || stmts == NIL);
|
||||
|
||||
portal->prepStmtName = prepStmtName;
|
||||
portal->sourceText = sourceText;
|
||||
@@ -468,7 +468,7 @@ MarkPortalFailed(Portal portal)
|
||||
void
|
||||
PortalDrop(Portal portal, bool isTopCommit)
|
||||
{
|
||||
AssertArg(PortalIsValid(portal));
|
||||
Assert(PortalIsValid(portal));
|
||||
|
||||
/*
|
||||
* Don't allow dropping a pinned portal, it's still needed by whoever
|
||||
|
||||
@@ -254,7 +254,7 @@ SlabReset(MemoryContext context)
|
||||
SlabContext *slab = (SlabContext *) context;
|
||||
int i;
|
||||
|
||||
AssertArg(SlabIsValid(slab));
|
||||
Assert(SlabIsValid(slab));
|
||||
|
||||
#ifdef MEMORY_CONTEXT_CHECKING
|
||||
/* Check for corruption and leaks before freeing */
|
||||
@@ -313,7 +313,7 @@ SlabAlloc(MemoryContext context, Size size)
|
||||
MemoryChunk *chunk;
|
||||
int idx;
|
||||
|
||||
AssertArg(SlabIsValid(slab));
|
||||
Assert(SlabIsValid(slab));
|
||||
|
||||
Assert((slab->minFreeChunks >= 0) &&
|
||||
(slab->minFreeChunks < slab->chunksPerBlock));
|
||||
@@ -475,7 +475,7 @@ SlabFree(void *pointer)
|
||||
* Future field experience may show that this Assert had better become a
|
||||
* regular runtime test-and-elog check.
|
||||
*/
|
||||
AssertArg(SlabBlockIsValid(block));
|
||||
Assert(SlabBlockIsValid(block));
|
||||
slab = block->slab;
|
||||
|
||||
#ifdef MEMORY_CONTEXT_CHECKING
|
||||
@@ -593,7 +593,7 @@ SlabGetChunkContext(void *pointer)
|
||||
MemoryChunk *chunk = PointerGetMemoryChunk(pointer);
|
||||
SlabBlock *block = MemoryChunkGetBlock(chunk);
|
||||
|
||||
AssertArg(SlabBlockIsValid(block));
|
||||
Assert(SlabBlockIsValid(block));
|
||||
return &block->slab->header;
|
||||
}
|
||||
|
||||
@@ -609,7 +609,7 @@ SlabGetChunkSpace(void *pointer)
|
||||
SlabBlock *block = MemoryChunkGetBlock(chunk);
|
||||
SlabContext *slab;
|
||||
|
||||
AssertArg(SlabBlockIsValid(block));
|
||||
Assert(SlabBlockIsValid(block));
|
||||
slab = block->slab;
|
||||
|
||||
return slab->fullChunkSize;
|
||||
@@ -624,7 +624,7 @@ SlabIsEmpty(MemoryContext context)
|
||||
{
|
||||
SlabContext *slab = (SlabContext *) context;
|
||||
|
||||
AssertArg(SlabIsValid(slab));
|
||||
Assert(SlabIsValid(slab));
|
||||
|
||||
return (slab->nblocks == 0);
|
||||
}
|
||||
@@ -651,7 +651,7 @@ SlabStats(MemoryContext context,
|
||||
Size freespace = 0;
|
||||
int i;
|
||||
|
||||
AssertArg(SlabIsValid(slab));
|
||||
Assert(SlabIsValid(slab));
|
||||
|
||||
/* Include context header in totalspace */
|
||||
totalspace = slab->headerSize;
|
||||
@@ -709,7 +709,7 @@ SlabCheck(MemoryContext context)
|
||||
int i;
|
||||
const char *name = slab->header.name;
|
||||
|
||||
AssertArg(SlabIsValid(slab));
|
||||
Assert(SlabIsValid(slab));
|
||||
Assert(slab->chunksPerBlock > 0);
|
||||
|
||||
/* walk all the freelists */
|
||||
|
||||
@@ -145,7 +145,7 @@ tuplesort_begin_heap(TupleDesc tupDesc,
|
||||
|
||||
oldcontext = MemoryContextSwitchTo(base->maincontext);
|
||||
|
||||
AssertArg(nkeys > 0);
|
||||
Assert(nkeys > 0);
|
||||
|
||||
#ifdef TRACE_SORT
|
||||
if (trace_sort)
|
||||
@@ -177,8 +177,8 @@ tuplesort_begin_heap(TupleDesc tupDesc,
|
||||
{
|
||||
SortSupport sortKey = base->sortKeys + i;
|
||||
|
||||
AssertArg(attNums[i] != 0);
|
||||
AssertArg(sortOperators[i] != 0);
|
||||
Assert(attNums[i] != 0);
|
||||
Assert(sortOperators[i] != 0);
|
||||
|
||||
sortKey->ssup_cxt = CurrentMemoryContext;
|
||||
sortKey->ssup_collation = sortCollations[i];
|
||||
@@ -297,7 +297,7 @@ tuplesort_begin_cluster(TupleDesc tupDesc,
|
||||
/* Convey if abbreviation optimization is applicable in principle */
|
||||
sortKey->abbreviate = (i == 0 && base->haveDatum1);
|
||||
|
||||
AssertState(sortKey->ssup_attno != 0);
|
||||
Assert(sortKey->ssup_attno != 0);
|
||||
|
||||
strategy = (scanKey->sk_flags & SK_BT_DESC) != 0 ?
|
||||
BTGreaterStrategyNumber : BTLessStrategyNumber;
|
||||
@@ -381,7 +381,7 @@ tuplesort_begin_index_btree(Relation heapRel,
|
||||
/* Convey if abbreviation optimization is applicable in principle */
|
||||
sortKey->abbreviate = (i == 0 && base->haveDatum1);
|
||||
|
||||
AssertState(sortKey->ssup_attno != 0);
|
||||
Assert(sortKey->ssup_attno != 0);
|
||||
|
||||
strategy = (scanKey->sk_flags & SK_BT_DESC) != 0 ?
|
||||
BTGreaterStrategyNumber : BTLessStrategyNumber;
|
||||
@@ -501,7 +501,7 @@ tuplesort_begin_index_gist(Relation heapRel,
|
||||
/* Convey if abbreviation optimization is applicable in principle */
|
||||
sortKey->abbreviate = (i == 0 && base->haveDatum1);
|
||||
|
||||
AssertState(sortKey->ssup_attno != 0);
|
||||
Assert(sortKey->ssup_attno != 0);
|
||||
|
||||
/* Look for a sort support function */
|
||||
PrepareSortSupportFromGistIndexRel(indexRel, sortKey);
|
||||
|
||||
Reference in New Issue
Block a user