On Mon, 21 Mar 2022 at 17:23, Aleksander Alekseev <[email protected]>
wrote:
> Hi Pavel,
>
>> Probably you can do (long long) instead of (long long int). It is shorter
>> and this is used elsewhere in the code.
>
> Thanks! Here is the updated patch. I also added Reviewed-by: and
> Discussion: to the commit message.
Hi,
After apply the patch, I found pg_checksums.c also has the similar code.
In progress_report(), I'm not sure we can do this replace for this code.
snprintf(total_size_str, sizeof(total_size_str), INT64_FORMAT,
total_size / (1024 * 1024));
snprintf(current_size_str, sizeof(current_size_str), INT64_FORMAT,
current_size / (1024 * 1024));
fprintf(stderr, _("%*s/%s MB (%d%%) computed"),
(int) strlen(current_size_str), current_size_str, total_size_str,
percent);
--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.
diff --git a/src/bin/pg_checksums/pg_checksums.c b/src/bin/pg_checksums/pg_checksums.c
index 7e69475947..e45e436683 100644
--- a/src/bin/pg_checksums/pg_checksums.c
+++ b/src/bin/pg_checksums/pg_checksums.c
@@ -657,11 +657,11 @@ main(int argc, char *argv[])
progress_report(true);
printf(_("Checksum operation completed\n"));
- printf(_("Files scanned: %s\n"), psprintf(INT64_FORMAT, files_scanned));
- printf(_("Blocks scanned: %s\n"), psprintf(INT64_FORMAT, blocks_scanned));
+ printf(_("Files scanned: %lld\n"), files_scanned);
+ printf(_("Blocks scanned: %lld\n"), blocks_scanned);
if (mode == PG_MODE_CHECK)
{
- printf(_("Bad checksums: %s\n"), psprintf(INT64_FORMAT, badblocks));
+ printf(_("Bad checksums: %lld\n"), badblocks);
printf(_("Data checksum version: %u\n"), ControlFile->data_checksum_version);
if (badblocks > 0)
@@ -669,8 +669,8 @@ main(int argc, char *argv[])
}
else if (mode == PG_MODE_ENABLE)
{
- printf(_("Files written: %s\n"), psprintf(INT64_FORMAT, files_written));
- printf(_("Blocks written: %s\n"), psprintf(INT64_FORMAT, blocks_written));
+ printf(_("Files written: %lld\n"), files_written);
+ printf(_("Blocks written: %lld\n"), blocks_written);
}
}