From b63443718a4a3a50304610e6ccda93bbfa06a1e6 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sat, 27 Dec 2025 22:50:46 +0100 Subject: Remove MsgType type Presumably, the C type MsgType was meant to hold the protocol message type in the pre-version-3 era, but this was never fully developed even then, and the name is pretty confusing nowadays. It has only one vestigial use for cancel requests that we can get rid of. Since a cancel request is indicated by a special protocol version number, we can use the ProtocolVersion type, which MsgType was based on. Reviewed-by: Chao Li Discussion: https://www.postgresql.org/message-id/flat/505e76cb-0ca2-4e22-ba0f-772b5dc3f230%40eisentraut.org --- src/interfaces/libpq/fe-cancel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/interfaces') diff --git a/src/interfaces/libpq/fe-cancel.c b/src/interfaces/libpq/fe-cancel.c index c872a0267f0..f23caf8349d 100644 --- a/src/interfaces/libpq/fe-cancel.c +++ b/src/interfaces/libpq/fe-cancel.c @@ -448,7 +448,7 @@ PQgetCancel(PGconn *conn) } req = (CancelRequestPacket *) &cancel->cancel_req; - req->cancelRequestCode = (MsgType) pg_hton32(CANCEL_REQUEST_CODE); + req->cancelRequestCode = pg_hton32(CANCEL_REQUEST_CODE); req->backendPID = pg_hton32(conn->be_pid); memcpy(req->cancelAuthCode, conn->be_cancel_key, conn->be_cancel_key_len); /* include the length field itself in the length */ @@ -479,7 +479,7 @@ PQsendCancelRequest(PGconn *cancelConn) /* Send the message body. */ memset(&req, 0, offsetof(CancelRequestPacket, cancelAuthCode)); - req.cancelRequestCode = (MsgType) pg_hton32(CANCEL_REQUEST_CODE); + req.cancelRequestCode = pg_hton32(CANCEL_REQUEST_CODE); req.backendPID = pg_hton32(cancelConn->be_pid); if (pqPutnchar(&req, offsetof(CancelRequestPacket, cancelAuthCode), cancelConn)) return STATUS_ERROR; -- cgit v1.2.3