mirror of
https://github.com/postgres/postgres.git
synced 2025-11-19 13:42:17 +03:00
Remove unnecessary (char *) casts [xlog]
Remove (char *) casts no longer needed after XLogRegisterData() and XLogRegisterBufData() argument type change. Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> Discussion: https://www.postgresql.org/message-id/flat/fd1fcedb-3492-4fc8-9e3e-74b97f2db6c7%40eisentraut.org
This commit is contained in:
@@ -2133,7 +2133,7 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid,
|
||||
}
|
||||
|
||||
XLogBeginInsert();
|
||||
XLogRegisterData((char *) &xlrec, SizeOfHeapInsert);
|
||||
XLogRegisterData(&xlrec, SizeOfHeapInsert);
|
||||
|
||||
xlhdr.t_infomask2 = heaptup->t_data->t_infomask2;
|
||||
xlhdr.t_infomask = heaptup->t_data->t_infomask;
|
||||
@@ -2145,7 +2145,7 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid,
|
||||
* xl_heap_header in the xlog.
|
||||
*/
|
||||
XLogRegisterBuffer(0, buffer, REGBUF_STANDARD | bufflags);
|
||||
XLogRegisterBufData(0, (char *) &xlhdr, SizeOfHeapHeader);
|
||||
XLogRegisterBufData(0, &xlhdr, SizeOfHeapHeader);
|
||||
/* PG73FORMAT: write bitmap [+ padding] [+ oid] + data */
|
||||
XLogRegisterBufData(0,
|
||||
(char *) heaptup->t_data + SizeofHeapTupleHeader,
|
||||
@@ -2542,7 +2542,7 @@ heap_multi_insert(Relation relation, TupleTableSlot **slots, int ntuples,
|
||||
bufflags |= REGBUF_KEEP_DATA;
|
||||
|
||||
XLogBeginInsert();
|
||||
XLogRegisterData((char *) xlrec, tupledata - scratch.data);
|
||||
XLogRegisterData(xlrec, tupledata - scratch.data);
|
||||
XLogRegisterBuffer(0, buffer, REGBUF_STANDARD | bufflags);
|
||||
|
||||
XLogRegisterBufData(0, tupledata, totaldatalen);
|
||||
@@ -3032,7 +3032,7 @@ l1:
|
||||
}
|
||||
|
||||
XLogBeginInsert();
|
||||
XLogRegisterData((char *) &xlrec, SizeOfHeapDelete);
|
||||
XLogRegisterData(&xlrec, SizeOfHeapDelete);
|
||||
|
||||
XLogRegisterBuffer(0, buffer, REGBUF_STANDARD);
|
||||
|
||||
@@ -3045,7 +3045,7 @@ l1:
|
||||
xlhdr.t_infomask = old_key_tuple->t_data->t_infomask;
|
||||
xlhdr.t_hoff = old_key_tuple->t_data->t_hoff;
|
||||
|
||||
XLogRegisterData((char *) &xlhdr, SizeOfHeapHeader);
|
||||
XLogRegisterData(&xlhdr, SizeOfHeapHeader);
|
||||
XLogRegisterData((char *) old_key_tuple->t_data
|
||||
+ SizeofHeapTupleHeader,
|
||||
old_key_tuple->t_len
|
||||
@@ -3811,7 +3811,7 @@ l2:
|
||||
oldtup.t_data->t_infomask2);
|
||||
xlrec.flags =
|
||||
cleared_all_frozen ? XLH_LOCK_ALL_FROZEN_CLEARED : 0;
|
||||
XLogRegisterData((char *) &xlrec, SizeOfHeapLock);
|
||||
XLogRegisterData(&xlrec, SizeOfHeapLock);
|
||||
recptr = XLogInsert(RM_HEAP_ID, XLOG_HEAP_LOCK);
|
||||
PageSetLSN(page, recptr);
|
||||
}
|
||||
@@ -5142,7 +5142,7 @@ failed:
|
||||
xlrec.infobits_set = compute_infobits(new_infomask,
|
||||
tuple->t_data->t_infomask2);
|
||||
xlrec.flags = cleared_all_frozen ? XLH_LOCK_ALL_FROZEN_CLEARED : 0;
|
||||
XLogRegisterData((char *) &xlrec, SizeOfHeapLock);
|
||||
XLogRegisterData(&xlrec, SizeOfHeapLock);
|
||||
|
||||
/* we don't decode row locks atm, so no need to log the origin */
|
||||
|
||||
@@ -5895,7 +5895,7 @@ l4:
|
||||
xlrec.flags =
|
||||
cleared_all_frozen ? XLH_LOCK_ALL_FROZEN_CLEARED : 0;
|
||||
|
||||
XLogRegisterData((char *) &xlrec, SizeOfHeapLockUpdated);
|
||||
XLogRegisterData(&xlrec, SizeOfHeapLockUpdated);
|
||||
|
||||
recptr = XLogInsert(RM_HEAP2_ID, XLOG_HEAP2_LOCK_UPDATED);
|
||||
|
||||
@@ -6048,7 +6048,7 @@ heap_finish_speculative(Relation relation, ItemPointer tid)
|
||||
/* We want the same filtering on this as on a plain insert */
|
||||
XLogSetRecordFlags(XLOG_INCLUDE_ORIGIN);
|
||||
|
||||
XLogRegisterData((char *) &xlrec, SizeOfHeapConfirm);
|
||||
XLogRegisterData(&xlrec, SizeOfHeapConfirm);
|
||||
XLogRegisterBuffer(0, buffer, REGBUF_STANDARD);
|
||||
|
||||
recptr = XLogInsert(RM_HEAP_ID, XLOG_HEAP_CONFIRM);
|
||||
@@ -6193,7 +6193,7 @@ heap_abort_speculative(Relation relation, ItemPointer tid)
|
||||
xlrec.xmax = xid;
|
||||
|
||||
XLogBeginInsert();
|
||||
XLogRegisterData((char *) &xlrec, SizeOfHeapDelete);
|
||||
XLogRegisterData(&xlrec, SizeOfHeapDelete);
|
||||
XLogRegisterBuffer(0, buffer, REGBUF_STANDARD);
|
||||
|
||||
/* No replica identity & replication origin logged */
|
||||
@@ -6489,9 +6489,9 @@ heap_inplace_update_and_unlock(Relation relation,
|
||||
xlrec.nmsgs = nmsgs;
|
||||
|
||||
XLogBeginInsert();
|
||||
XLogRegisterData((char *) &xlrec, MinSizeOfHeapInplace);
|
||||
XLogRegisterData(&xlrec, MinSizeOfHeapInplace);
|
||||
if (nmsgs != 0)
|
||||
XLogRegisterData((char *) invalMessages,
|
||||
XLogRegisterData(invalMessages,
|
||||
nmsgs * sizeof(SharedInvalidationMessage));
|
||||
|
||||
/* register block matching what buffer will look like after changes */
|
||||
@@ -8722,7 +8722,7 @@ log_heap_visible(Relation rel, Buffer heap_buffer, Buffer vm_buffer,
|
||||
if (RelationIsAccessibleInLogicalDecoding(rel))
|
||||
xlrec.flags |= VISIBILITYMAP_XLOG_CATALOG_REL;
|
||||
XLogBeginInsert();
|
||||
XLogRegisterData((char *) &xlrec, SizeOfHeapVisible);
|
||||
XLogRegisterData(&xlrec, SizeOfHeapVisible);
|
||||
|
||||
XLogRegisterBuffer(0, vm_buffer, 0);
|
||||
|
||||
@@ -8873,7 +8873,7 @@ log_heap_update(Relation reln, Buffer oldbuf,
|
||||
if (oldbuf != newbuf)
|
||||
XLogRegisterBuffer(1, oldbuf, REGBUF_STANDARD);
|
||||
|
||||
XLogRegisterData((char *) &xlrec, SizeOfHeapUpdate);
|
||||
XLogRegisterData(&xlrec, SizeOfHeapUpdate);
|
||||
|
||||
/*
|
||||
* Prepare WAL data for the new tuple.
|
||||
@@ -8884,15 +8884,15 @@ log_heap_update(Relation reln, Buffer oldbuf,
|
||||
{
|
||||
prefix_suffix[0] = prefixlen;
|
||||
prefix_suffix[1] = suffixlen;
|
||||
XLogRegisterBufData(0, (char *) &prefix_suffix, sizeof(uint16) * 2);
|
||||
XLogRegisterBufData(0, &prefix_suffix, sizeof(uint16) * 2);
|
||||
}
|
||||
else if (prefixlen > 0)
|
||||
{
|
||||
XLogRegisterBufData(0, (char *) &prefixlen, sizeof(uint16));
|
||||
XLogRegisterBufData(0, &prefixlen, sizeof(uint16));
|
||||
}
|
||||
else
|
||||
{
|
||||
XLogRegisterBufData(0, (char *) &suffixlen, sizeof(uint16));
|
||||
XLogRegisterBufData(0, &suffixlen, sizeof(uint16));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8906,11 +8906,11 @@ log_heap_update(Relation reln, Buffer oldbuf,
|
||||
*
|
||||
* The 'data' doesn't include the common prefix or suffix.
|
||||
*/
|
||||
XLogRegisterBufData(0, (char *) &xlhdr, SizeOfHeapHeader);
|
||||
XLogRegisterBufData(0, &xlhdr, SizeOfHeapHeader);
|
||||
if (prefixlen == 0)
|
||||
{
|
||||
XLogRegisterBufData(0,
|
||||
((char *) newtup->t_data) + SizeofHeapTupleHeader,
|
||||
(char *) newtup->t_data + SizeofHeapTupleHeader,
|
||||
newtup->t_len - SizeofHeapTupleHeader - suffixlen);
|
||||
}
|
||||
else
|
||||
@@ -8923,13 +8923,13 @@ log_heap_update(Relation reln, Buffer oldbuf,
|
||||
if (newtup->t_data->t_hoff - SizeofHeapTupleHeader > 0)
|
||||
{
|
||||
XLogRegisterBufData(0,
|
||||
((char *) newtup->t_data) + SizeofHeapTupleHeader,
|
||||
(char *) newtup->t_data + SizeofHeapTupleHeader,
|
||||
newtup->t_data->t_hoff - SizeofHeapTupleHeader);
|
||||
}
|
||||
|
||||
/* data after common prefix */
|
||||
XLogRegisterBufData(0,
|
||||
((char *) newtup->t_data) + newtup->t_data->t_hoff + prefixlen,
|
||||
(char *) newtup->t_data + newtup->t_data->t_hoff + prefixlen,
|
||||
newtup->t_len - newtup->t_data->t_hoff - prefixlen - suffixlen);
|
||||
}
|
||||
|
||||
@@ -8941,7 +8941,7 @@ log_heap_update(Relation reln, Buffer oldbuf,
|
||||
xlhdr_idx.t_infomask = old_key_tuple->t_data->t_infomask;
|
||||
xlhdr_idx.t_hoff = old_key_tuple->t_data->t_hoff;
|
||||
|
||||
XLogRegisterData((char *) &xlhdr_idx, SizeOfHeapHeader);
|
||||
XLogRegisterData(&xlhdr_idx, SizeOfHeapHeader);
|
||||
|
||||
/* PG73FORMAT: write bitmap [+ padding] [+ oid] + data */
|
||||
XLogRegisterData((char *) old_key_tuple->t_data + SizeofHeapTupleHeader,
|
||||
@@ -9021,7 +9021,7 @@ log_heap_new_cid(Relation relation, HeapTuple tup)
|
||||
* called us certainly did, but that's WAL-logged separately.
|
||||
*/
|
||||
XLogBeginInsert();
|
||||
XLogRegisterData((char *) &xlrec, SizeOfHeapNewCid);
|
||||
XLogRegisterData(&xlrec, SizeOfHeapNewCid);
|
||||
|
||||
/* will be looked at irrespective of origin */
|
||||
|
||||
|
||||
@@ -2093,9 +2093,9 @@ log_heap_prune_and_freeze(Relation relation, Buffer buffer,
|
||||
nplans = heap_log_freeze_plan(frozen, nfrozen, plans, frz_offsets);
|
||||
|
||||
freeze_plans.nplans = nplans;
|
||||
XLogRegisterBufData(0, (char *) &freeze_plans,
|
||||
XLogRegisterBufData(0, &freeze_plans,
|
||||
offsetof(xlhp_freeze_plans, plans));
|
||||
XLogRegisterBufData(0, (char *) plans,
|
||||
XLogRegisterBufData(0, plans,
|
||||
sizeof(xlhp_freeze_plan) * nplans);
|
||||
}
|
||||
if (nredirected > 0)
|
||||
@@ -2103,9 +2103,9 @@ log_heap_prune_and_freeze(Relation relation, Buffer buffer,
|
||||
xlrec.flags |= XLHP_HAS_REDIRECTIONS;
|
||||
|
||||
redirect_items.ntargets = nredirected;
|
||||
XLogRegisterBufData(0, (char *) &redirect_items,
|
||||
XLogRegisterBufData(0, &redirect_items,
|
||||
offsetof(xlhp_prune_items, data));
|
||||
XLogRegisterBufData(0, (char *) redirected,
|
||||
XLogRegisterBufData(0, redirected,
|
||||
sizeof(OffsetNumber[2]) * nredirected);
|
||||
}
|
||||
if (ndead > 0)
|
||||
@@ -2113,9 +2113,9 @@ log_heap_prune_and_freeze(Relation relation, Buffer buffer,
|
||||
xlrec.flags |= XLHP_HAS_DEAD_ITEMS;
|
||||
|
||||
dead_items.ntargets = ndead;
|
||||
XLogRegisterBufData(0, (char *) &dead_items,
|
||||
XLogRegisterBufData(0, &dead_items,
|
||||
offsetof(xlhp_prune_items, data));
|
||||
XLogRegisterBufData(0, (char *) dead,
|
||||
XLogRegisterBufData(0, dead,
|
||||
sizeof(OffsetNumber) * ndead);
|
||||
}
|
||||
if (nunused > 0)
|
||||
@@ -2123,13 +2123,13 @@ log_heap_prune_and_freeze(Relation relation, Buffer buffer,
|
||||
xlrec.flags |= XLHP_HAS_NOW_UNUSED_ITEMS;
|
||||
|
||||
unused_items.ntargets = nunused;
|
||||
XLogRegisterBufData(0, (char *) &unused_items,
|
||||
XLogRegisterBufData(0, &unused_items,
|
||||
offsetof(xlhp_prune_items, data));
|
||||
XLogRegisterBufData(0, (char *) unused,
|
||||
XLogRegisterBufData(0, unused,
|
||||
sizeof(OffsetNumber) * nunused);
|
||||
}
|
||||
if (nfrozen > 0)
|
||||
XLogRegisterBufData(0, (char *) frz_offsets,
|
||||
XLogRegisterBufData(0, frz_offsets,
|
||||
sizeof(OffsetNumber) * nfrozen);
|
||||
|
||||
/*
|
||||
@@ -2147,9 +2147,9 @@ log_heap_prune_and_freeze(Relation relation, Buffer buffer,
|
||||
Assert(nredirected == 0 && ndead == 0);
|
||||
/* also, any items in 'unused' must've been LP_DEAD previously */
|
||||
}
|
||||
XLogRegisterData((char *) &xlrec, SizeOfHeapPrune);
|
||||
XLogRegisterData(&xlrec, SizeOfHeapPrune);
|
||||
if (TransactionIdIsValid(conflict_xid))
|
||||
XLogRegisterData((char *) &conflict_xid, sizeof(TransactionId));
|
||||
XLogRegisterData(&conflict_xid, sizeof(TransactionId));
|
||||
|
||||
switch (reason)
|
||||
{
|
||||
|
||||
@@ -887,7 +887,7 @@ logical_heap_rewrite_flush_mappings(RewriteState state)
|
||||
src->off += len;
|
||||
|
||||
XLogBeginInsert();
|
||||
XLogRegisterData((char *) (&xlrec), sizeof(xlrec));
|
||||
XLogRegisterData(&xlrec, sizeof(xlrec));
|
||||
XLogRegisterData(waldata_start, len);
|
||||
|
||||
/* write xlog record */
|
||||
|
||||
Reference in New Issue
Block a user