postgres.git / summary / log / commit / refs

commit    b18c2decd76eeffbd483c041c02bb0fb01b0f124
Author:   Peter Eisentraut <peter@eisentraut.org>
Date:     Wed Dec 14 15:08:13 2022 +0000
First released in: 16.0

    Rearrange some static assertions for consistency
    
    Put lengthof first.
    
    Reported-by: Peter Smith <smithpb2250@gmail.com>
    Discussion: https://www.postgresql.org/message-id/CAHut+PsUDMySVRuRc=h+P5N3+=TGvj4W_mi32XXg9dt4o-BXbA@mail.gmail.com


src/backend/executor/execExprInterp.c | 2 +- src/backend/utils/cache/syscache.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/executor/execExprInterp.c b/src/backend/executor/execExprInterp.c index 1dab2787b79..be48886511e 100644 --- a/src/backend/executor/execExprInterp.c +++ b/src/backend/executor/execExprInterp.c @@ -496,7 +496,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) &&CASE_EEOP_LAST }; - StaticAssertStmt(EEOP_LAST + 1 == lengthof(dispatch_table), + StaticAssertStmt(lengthof(dispatch_table) == EEOP_LAST + 1, "dispatch_table out of whack with ExprEvalOp"); if (unlikely(state == NULL)) diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c index eec644ec848..8b359683539 100644 --- a/src/backend/utils/cache/syscache.c +++ b/src/backend/utils/cache/syscache.c @@ -1068,7 +1068,7 @@ InitCatalogCache(void) { int cacheId; - StaticAssertStmt(SysCacheSize == (int) lengthof(cacheinfo), + StaticAssertStmt(lengthof(cacheinfo) == SysCacheSize, "SysCacheSize does not match syscache.c's array"); Assert(!CacheInitialized); [parent: 6fcda9aba834]