Skip to content

Commit ebdccea

Browse files
committed
SnapBuildRestoreContents() void * argument for binary data
Change internal snapbuild API function to take void * for binary data instead of char *. This removes the need for numerous casts. Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> Discussion: https://www.postgresql.org/message-id/flat/fd1fcedb-3492-4fc8-9e3e-74b97f2db6c7%40eisentraut.org
1 parent a4e986e commit ebdccea

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/backend/replication/logical/snapbuild.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ static void SnapBuildWaitSnapshot(xl_running_xacts *running, TransactionId cutof
173173
/* serialization functions */
174174
static void SnapBuildSerialize(SnapBuild *builder, XLogRecPtr lsn);
175175
static bool SnapBuildRestore(SnapBuild *builder, XLogRecPtr lsn);
176-
static void SnapBuildRestoreContents(int fd, char *dest, Size size, const char *path);
176+
static void SnapBuildRestoreContents(int fd, void *dest, Size size, const char *path);
177177

178178
/*
179179
* Allocate a new snapshot builder.
@@ -1722,7 +1722,7 @@ SnapBuildRestoreSnapshot(SnapBuildOnDisk *ondisk, const char *path,
17221722
fsync_fname(PG_LOGICAL_SNAPSHOTS_DIR, true);
17231723

17241724
/* read statically sized portion of snapshot */
1725-
SnapBuildRestoreContents(fd, (char *) ondisk, SnapBuildOnDiskConstantSize, path);
1725+
SnapBuildRestoreContents(fd, ondisk, SnapBuildOnDiskConstantSize, path);
17261726

17271727
if (ondisk->magic != SNAPBUILD_MAGIC)
17281728
ereport(ERROR,
@@ -1742,15 +1742,15 @@ SnapBuildRestoreSnapshot(SnapBuildOnDisk *ondisk, const char *path,
17421742
SnapBuildOnDiskConstantSize - SnapBuildOnDiskNotChecksummedSize);
17431743

17441744
/* read SnapBuild */
1745-
SnapBuildRestoreContents(fd, (char *) &ondisk->builder, sizeof(SnapBuild), path);
1745+
SnapBuildRestoreContents(fd, &ondisk->builder, sizeof(SnapBuild), path);
17461746
COMP_CRC32C(checksum, &ondisk->builder, sizeof(SnapBuild));
17471747

17481748
/* restore committed xacts information */
17491749
if (ondisk->builder.committed.xcnt > 0)
17501750
{
17511751
sz = sizeof(TransactionId) * ondisk->builder.committed.xcnt;
17521752
ondisk->builder.committed.xip = MemoryContextAllocZero(context, sz);
1753-
SnapBuildRestoreContents(fd, (char *) ondisk->builder.committed.xip, sz, path);
1753+
SnapBuildRestoreContents(fd, ondisk->builder.committed.xip, sz, path);
17541754
COMP_CRC32C(checksum, ondisk->builder.committed.xip, sz);
17551755
}
17561756

@@ -1759,7 +1759,7 @@ SnapBuildRestoreSnapshot(SnapBuildOnDisk *ondisk, const char *path,
17591759
{
17601760
sz = sizeof(TransactionId) * ondisk->builder.catchange.xcnt;
17611761
ondisk->builder.catchange.xip = MemoryContextAllocZero(context, sz);
1762-
SnapBuildRestoreContents(fd, (char *) ondisk->builder.catchange.xip, sz, path);
1762+
SnapBuildRestoreContents(fd, ondisk->builder.catchange.xip, sz, path);
17631763
COMP_CRC32C(checksum, ondisk->builder.catchange.xip, sz);
17641764
}
17651765

@@ -1882,7 +1882,7 @@ SnapBuildRestore(SnapBuild *builder, XLogRecPtr lsn)
18821882
* Read the contents of the serialized snapshot to 'dest'.
18831883
*/
18841884
static void
1885-
SnapBuildRestoreContents(int fd, char *dest, Size size, const char *path)
1885+
SnapBuildRestoreContents(int fd, void *dest, Size size, const char *path)
18861886
{
18871887
int readBytes;
18881888

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy