Skip to content

Commit 6deb3bb

Browse files
fileEqualCRC() refactoring
1 parent 4befefa commit 6deb3bb

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/data.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1738,8 +1738,8 @@ check_file_pages(pgFile *file, XLogRecPtr stop_lsn,
17381738
static bool
17391739
fileEqualCRC(const char *path1, const char *path2, bool path2_is_compressed)
17401740
{
1741-
pg_crc32 crc_from;
1742-
pg_crc32 crc_to;
1741+
pg_crc32 crc1;
1742+
pg_crc32 crc2;
17431743

17441744
/* Get checksum of backup file */
17451745
#ifdef HAVE_LIBZ
@@ -1748,7 +1748,7 @@ fileEqualCRC(const char *path1, const char *path2, bool path2_is_compressed)
17481748
char buf [1024];
17491749
gzFile gz_in = NULL;
17501750

1751-
INIT_CRC32C(crc_to);
1751+
INIT_CRC32C(crc2);
17521752
gz_in = gzopen(path2, PG_BINARY_R);
17531753
if (gz_in == NULL)
17541754
{
@@ -1771,11 +1771,11 @@ fileEqualCRC(const char *path1, const char *path2, bool path2_is_compressed)
17711771
path1, path2);
17721772
return false;
17731773
}
1774-
COMP_CRC32C(crc_to, buf, read_len);
1774+
COMP_CRC32C(crc2, buf, read_len);
17751775
if (gzeof(gz_in) || read_len == 0)
17761776
break;
17771777
}
1778-
FIN_CRC32C(crc_to);
1778+
FIN_CRC32C(crc2);
17791779

17801780
if (gzclose(gz_in) != 0)
17811781
elog(ERROR, "Cannot close compressed WAL file \"%s\": %s",
@@ -1784,11 +1784,11 @@ fileEqualCRC(const char *path1, const char *path2, bool path2_is_compressed)
17841784
else
17851785
#endif
17861786
{
1787-
crc_to = pgFileGetCRC(path2);
1787+
crc2 = pgFileGetCRC(path2);
17881788
}
17891789

17901790
/* Get checksum of original file */
1791-
crc_from = pgFileGetCRC(path1);
1791+
crc1 = pgFileGetCRC(path1);
17921792

1793-
return EQ_CRC32C(crc_from, crc_to);
1793+
return EQ_CRC32C(crc1, crc2);
17941794
}

0 commit comments

Comments
 (0)