diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2019-06-06 14:14:29 +0200 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2019-07-04 17:01:43 +0200 |
commit | 6a1cd8b9236dcfa91b40af3a8337859e16ba7113 (patch) | |
tree | d28df515cafc7354c03588285edf9b1e7ad7656d /src/backend/access/transam/xlogreader.c | |
parent | 7b925e12703652fef63a2fbbb28d3407b2971d6e (diff) |
Unwind some workarounds for lack of portable int64 format specifier
Because there is no portable int64/uint64 format specifier and we
can't stick macros like INT64_FORMAT into the middle of a translatable
string, we have been using various workarounds that put the number to
be printed into a string buffer first. Now that we always use our own
sprintf(), we can rely on %lld and %llu to work, so we can use those.
This patch undoes this workaround in a few places where it was
egregiously verbose.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/CAH2-Wz%3DWbNxc5ob5NJ9yqo2RMJ0q4HXDS30GVCobeCvC9A1L9A%40mail.gmail.com
Diffstat (limited to 'src/backend/access/transam/xlogreader.c')
-rw-r--r-- | src/backend/access/transam/xlogreader.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/backend/access/transam/xlogreader.c b/src/backend/access/transam/xlogreader.c index 88be7fe0223..41dae916b46 100644 --- a/src/backend/access/transam/xlogreader.c +++ b/src/backend/access/transam/xlogreader.c @@ -783,20 +783,10 @@ XLogReaderValidatePageHeader(XLogReaderState *state, XLogRecPtr recptr, if (state->system_identifier && longhdr->xlp_sysid != state->system_identifier) { - char fhdrident_str[32]; - char sysident_str[32]; - - /* - * Format sysids separately to keep platform-dependent format code - * out of the translatable message string. - */ - snprintf(fhdrident_str, sizeof(fhdrident_str), UINT64_FORMAT, - longhdr->xlp_sysid); - snprintf(sysident_str, sizeof(sysident_str), UINT64_FORMAT, - state->system_identifier); report_invalid_record(state, - "WAL file is from different database system: WAL file database system identifier is %s, pg_control database system identifier is %s", - fhdrident_str, sysident_str); + "WAL file is from different database system: WAL file database system identifier is %llu, pg_control database system identifier is %llu", + (unsigned long long) longhdr->xlp_sysid, + (unsigned long long) state->system_identifier); return false; } else if (longhdr->xlp_seg_size != state->wal_segment_size) |