mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Fix warning introduced in 5c279a6d35
.
Change two macros to be static inline functions instead to keep the data type consistent. This avoids a "comparison is always true" warning that was occurring with -Wtype-limits. In the process, change the names to look less like macros. Discussion: https://postgr.es/m/20220407063505.njnnrmbn4sxqfsts@alap3.anarazel.de
This commit is contained in:
@ -37,10 +37,20 @@ typedef enum RmgrIds
|
||||
#define RM_N_IDS (UINT8_MAX + 1)
|
||||
#define RM_N_BUILTIN_IDS (RM_MAX_BUILTIN_ID + 1)
|
||||
#define RM_N_CUSTOM_IDS (RM_MAX_CUSTOM_ID - RM_MIN_CUSTOM_ID + 1)
|
||||
#define RMID_IS_BUILTIN(rmid) ((rmid) <= RM_MAX_BUILTIN_ID)
|
||||
#define RMID_IS_CUSTOM(rmid) ((rmid) >= RM_MIN_CUSTOM_ID && \
|
||||
(rmid) <= RM_MAX_CUSTOM_ID)
|
||||
#define RMID_IS_VALID(rmid) (RMID_IS_BUILTIN((rmid)) || RMID_IS_CUSTOM((rmid)))
|
||||
|
||||
static inline bool
|
||||
RmgrIdIsBuiltin(int rmid)
|
||||
{
|
||||
return rmid <= RM_MAX_BUILTIN_ID;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
RmgrIdIsCustom(int rmid)
|
||||
{
|
||||
return rmid >= RM_MIN_CUSTOM_ID && rmid <= RM_MAX_CUSTOM_ID;
|
||||
}
|
||||
|
||||
#define RmgrIdIsValid(rmid) (RmgrIdIsBuiltin((rmid)) || RmgrIdIsCustom((rmid)))
|
||||
|
||||
/*
|
||||
* RmgrId to use for extensions that require an RmgrId, but are still in
|
||||
|
Reference in New Issue
Block a user