Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9553b41

Browse files
committed
Fix warning introduced in5c279a6.
Change two macros to be static inline functions instead to keep thedata type consistent. This avoids a "comparison is always true"warning that was occurring with -Wtype-limits. In the process, changethe names to look less like macros.Discussion:https://postgr.es/m/20220407063505.njnnrmbn4sxqfsts@alap3.anarazel.de
1 parente349c95 commit9553b41

File tree

5 files changed

+22
-12
lines changed

5 files changed

+22
-12
lines changed

‎src/backend/access/transam/rmgr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ RegisterCustomRmgr(RmgrId rmid, RmgrData *rmgr)
101101
ereport(ERROR, (errmsg("custom resource manager name is invalid"),
102102
errhint("Provide a non-empty name for the custom resource manager.")));
103103

104-
if (!RMID_IS_CUSTOM(rmid))
104+
if (!RmgrIdIsCustom(rmid))
105105
ereport(ERROR, (errmsg("custom resource manager ID %d is out of range",rmid),
106106
errhint("Provide a custom resource manager ID between %d and %d.",
107107
RM_MIN_CUSTOM_ID,RM_MAX_CUSTOM_ID)));
@@ -153,7 +153,7 @@ pg_get_wal_resource_managers(PG_FUNCTION_ARGS)
153153
continue;
154154
values[0]=Int32GetDatum(rmid);
155155
values[1]=CStringGetTextDatum(GetRmgr(rmid).rm_name);
156-
values[2]=BoolGetDatum(RMID_IS_BUILTIN(rmid));
156+
values[2]=BoolGetDatum(RmgrIdIsBuiltin(rmid));
157157
tuplestore_putvalues(rsinfo->setResult,rsinfo->setDesc,values,nulls);
158158
}
159159

‎src/backend/access/transam/xlogreader.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1102,7 +1102,7 @@ ValidXLogRecordHeader(XLogReaderState *state, XLogRecPtr RecPtr,
11021102
(uint32)SizeOfXLogRecord,record->xl_tot_len);
11031103
return false;
11041104
}
1105-
if (!RMID_IS_VALID(record->xl_rmid))
1105+
if (!RmgrIdIsValid(record->xl_rmid))
11061106
{
11071107
report_invalid_record(state,
11081108
"invalid resource manager ID %u at %X/%X",

‎src/bin/pg_waldump/pg_waldump.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ XLogDumpDisplayStats(XLogDumpConfig *config, XLogDumpStats *stats)
749749
tot_len;
750750
constRmgrDescData*desc;
751751

752-
if (!RMID_IS_VALID(ri))
752+
if (!RmgrIdIsValid(ri))
753753
continue;
754754

755755
desc=GetRmgrDesc(ri);
@@ -761,7 +761,7 @@ XLogDumpDisplayStats(XLogDumpConfig *config, XLogDumpStats *stats)
761761
fpi_len=stats->rmgr_stats[ri].fpi_len;
762762
tot_len=rec_len+fpi_len;
763763

764-
if (RMID_IS_CUSTOM(ri)&&count==0)
764+
if (RmgrIdIsCustom(ri)&&count==0)
765765
continue;
766766

767767
XLogDumpStatsRow(desc->rm_name,
@@ -1025,7 +1025,7 @@ main(int argc, char **argv)
10251025
*/
10261026
if (sscanf(optarg,"custom%03d",&rmid)==1)
10271027
{
1028-
if (!RMID_IS_CUSTOM(rmid))
1028+
if (!RmgrIdIsCustom(rmid))
10291029
{
10301030
pg_log_error("custom resource manager \"%s\" does not exist",
10311031
optarg);

‎src/bin/pg_waldump/rmgrdesc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ initialize_custom_rmgrs(void)
8686
constRmgrDescData*
8787
GetRmgrDesc(RmgrIdrmid)
8888
{
89-
Assert(RMID_IS_VALID(rmid));
89+
Assert(RmgrIdIsValid(rmid));
9090

91-
if (RMID_IS_BUILTIN(rmid))
91+
if (RmgrIdIsBuiltin(rmid))
9292
return&RmgrDescTable[rmid];
9393
else
9494
{

‎src/include/access/rmgr.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,20 @@ typedef enum RmgrIds
3737
#defineRM_N_IDS(UINT8_MAX + 1)
3838
#defineRM_N_BUILTIN_IDS(RM_MAX_BUILTIN_ID + 1)
3939
#defineRM_N_CUSTOM_IDS(RM_MAX_CUSTOM_ID - RM_MIN_CUSTOM_ID + 1)
40-
#defineRMID_IS_BUILTIN(rmid) ((rmid) <= RM_MAX_BUILTIN_ID)
41-
#defineRMID_IS_CUSTOM(rmid) ((rmid) >= RM_MIN_CUSTOM_ID && \
42-
(rmid) <= RM_MAX_CUSTOM_ID)
43-
#defineRMID_IS_VALID(rmid) (RMID_IS_BUILTIN((rmid)) || RMID_IS_CUSTOM((rmid)))
40+
41+
staticinlinebool
42+
RmgrIdIsBuiltin(intrmid)
43+
{
44+
returnrmid <=RM_MAX_BUILTIN_ID;
45+
}
46+
47+
staticinlinebool
48+
RmgrIdIsCustom(intrmid)
49+
{
50+
returnrmid >=RM_MIN_CUSTOM_ID&&rmid <=RM_MAX_CUSTOM_ID;
51+
}
52+
53+
#defineRmgrIdIsValid(rmid) (RmgrIdIsBuiltin((rmid)) || RmgrIdIsCustom((rmid)))
4454

4555
/*
4656
* RmgrId to use for extensions that require an RmgrId, but are still in

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp