mirror of
https://github.com/postgres/postgres.git
synced 2025-11-07 19:06:32 +03:00
More unconstify use
Replace casts whose only purpose is to cast away const with the unconstify() macro. Discussion: https://www.postgresql.org/message-id/flat/53a28052-f9f3-1808-fed9-460fd43035ab%402ndquadrant.com
This commit is contained in:
@@ -178,7 +178,7 @@ brin_doupdate(Relation idxrel, BlockNumber pagesPerRange,
|
||||
brin_can_do_samepage_update(oldbuf, origsz, newsz))
|
||||
{
|
||||
START_CRIT_SECTION();
|
||||
if (!PageIndexTupleOverwrite(oldpage, oldoff, (Item) newtup, newsz))
|
||||
if (!PageIndexTupleOverwrite(oldpage, oldoff, (Item) unconstify(BrinTuple *, newtup), newsz))
|
||||
elog(ERROR, "failed to replace BRIN tuple");
|
||||
MarkBufferDirty(oldbuf);
|
||||
|
||||
@@ -195,7 +195,7 @@ brin_doupdate(Relation idxrel, BlockNumber pagesPerRange,
|
||||
XLogRegisterData((char *) &xlrec, SizeOfBrinSamepageUpdate);
|
||||
|
||||
XLogRegisterBuffer(0, oldbuf, REGBUF_STANDARD);
|
||||
XLogRegisterBufData(0, (char *) newtup, newsz);
|
||||
XLogRegisterBufData(0, (char *) unconstify(BrinTuple *, newtup), newsz);
|
||||
|
||||
recptr = XLogInsert(RM_BRIN_ID, info);
|
||||
|
||||
@@ -252,7 +252,7 @@ brin_doupdate(Relation idxrel, BlockNumber pagesPerRange,
|
||||
brin_page_init(newpage, BRIN_PAGETYPE_REGULAR);
|
||||
|
||||
PageIndexTupleDeleteNoCompact(oldpage, oldoff);
|
||||
newoff = PageAddItem(newpage, (Item) newtup, newsz,
|
||||
newoff = PageAddItem(newpage, (Item) unconstify(BrinTuple *, newtup), newsz,
|
||||
InvalidOffsetNumber, false, false);
|
||||
if (newoff == InvalidOffsetNumber)
|
||||
elog(ERROR, "failed to add BRIN tuple to new page");
|
||||
@@ -287,7 +287,7 @@ brin_doupdate(Relation idxrel, BlockNumber pagesPerRange,
|
||||
XLogRegisterData((char *) &xlrec, SizeOfBrinUpdate);
|
||||
|
||||
XLogRegisterBuffer(0, newbuf, REGBUF_STANDARD | (extended ? REGBUF_WILL_INIT : 0));
|
||||
XLogRegisterBufData(0, (char *) newtup, newsz);
|
||||
XLogRegisterBufData(0, (char *) unconstify(BrinTuple *, newtup), newsz);
|
||||
|
||||
/* revmap page */
|
||||
XLogRegisterBuffer(1, revmapbuf, 0);
|
||||
|
||||
@@ -5409,7 +5409,7 @@ XactLogCommitRecord(TimestampTz commit_time,
|
||||
{
|
||||
XLogRegisterData((char *) (&xl_twophase), sizeof(xl_xact_twophase));
|
||||
if (xl_xinfo.xinfo & XACT_XINFO_HAS_GID)
|
||||
XLogRegisterData((char *) twophase_gid, strlen(twophase_gid) + 1);
|
||||
XLogRegisterData(unconstify(char *, twophase_gid), strlen(twophase_gid) + 1);
|
||||
}
|
||||
|
||||
if (xl_xinfo.xinfo & XACT_XINFO_HAS_ORIGIN)
|
||||
@@ -5537,7 +5537,7 @@ XactLogAbortRecord(TimestampTz abort_time,
|
||||
{
|
||||
XLogRegisterData((char *) (&xl_twophase), sizeof(xl_xact_twophase));
|
||||
if (xl_xinfo.xinfo & XACT_XINFO_HAS_GID)
|
||||
XLogRegisterData((char *) twophase_gid, strlen(twophase_gid) + 1);
|
||||
XLogRegisterData(unconstify(char *, twophase_gid), strlen(twophase_gid) + 1);
|
||||
}
|
||||
|
||||
if (xl_xinfo.xinfo & XACT_XINFO_HAS_ORIGIN)
|
||||
|
||||
Reference in New Issue
Block a user