summaryrefslogtreecommitdiff
path: root/src/include/access/rmgr.h
diff options
context:
space:
mode:
authorJeff Davis2022-04-07 07:27:07 +0000
committerJeff Davis2022-04-07 07:39:30 +0000
commit9553b4115f1879f66935f42fff0b798ef91866d0 (patch)
tree12a7f2e31a7b9e2d003b5a50513bf2b82fdeec80 /src/include/access/rmgr.h
parente349c95d3e91754c8c3afc0587d52d44a479c8d2 (diff)
Fix warning introduced in 5c279a6d350.
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/[email protected]
Diffstat (limited to 'src/include/access/rmgr.h')
-rw-r--r--src/include/access/rmgr.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/include/access/rmgr.h b/src/include/access/rmgr.h
index d9a96410d97..e465800e445 100644
--- a/src/include/access/rmgr.h
+++ b/src/include/access/rmgr.h
@@ -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