diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2021-02-23 10:14:38 +0100 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2021-02-23 10:27:02 +0100 |
commit | 6f6f284c7ee44264eb3e128e2bf54d9276711d11 (patch) | |
tree | c861d32584f751b28a065b98c03e1dd1370daa10 /src/backend/utils/adt/pg_lsn.c | |
parent | ade89ba5f408e6034db7cc8a2c9b7858f5a214c4 (diff) | |
download | postgresql-6f6f284c7ee44264eb3e128e2bf54d9276711d11.tar.gz postgresql-6f6f284c7ee44264eb3e128e2bf54d9276711d11.zip |
Simplify printing of LSNs
Add a macro LSN_FORMAT_ARGS for use in printf-style printing of LSNs.
Convert all applicable code to use it.
Reviewed-by: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://www.postgresql.org/message-id/flat/CAExHW5ub5NaTELZ3hJUCE6amuvqAtsSxc7O+uK7y4t9Rrk23cw@mail.gmail.com
Diffstat (limited to 'src/backend/utils/adt/pg_lsn.c')
-rw-r--r-- | src/backend/utils/adt/pg_lsn.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/src/backend/utils/adt/pg_lsn.c b/src/backend/utils/adt/pg_lsn.c index 12ad0c4c31e..b41dfe9eb0b 100644 --- a/src/backend/utils/adt/pg_lsn.c +++ b/src/backend/utils/adt/pg_lsn.c @@ -83,14 +83,8 @@ pg_lsn_out(PG_FUNCTION_ARGS) XLogRecPtr lsn = PG_GETARG_LSN(0); char buf[MAXPG_LSNLEN + 1]; char *result; - uint32 id, - off; - - /* Decode ID and offset */ - id = (uint32) (lsn >> 32); - off = (uint32) lsn; - snprintf(buf, sizeof buf, "%X/%X", id, off); + snprintf(buf, sizeof buf, "%X/%X", LSN_FORMAT_ARGS(lsn)); result = pstrdup(buf); PG_RETURN_CSTRING(result); } |