]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Remove MsgType type
authorPeter Eisentraut <peter@eisentraut.org>
Sat, 27 Dec 2025 21:50:46 +0000 (22:50 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Sat, 27 Dec 2025 22:46:28 +0000 (23:46 +0100)
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 <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/505e76cb-0ca2-4e22-ba0f-772b5dc3f230%40eisentraut.org

src/include/libpq/pqcomm.h
src/interfaces/libpq/fe-cancel.c
src/tools/pgindent/typedefs.list

index 625f4b43879b6d2cb64ed2897931f3baae780e08..235f6ed7d0d9b002e20eebbe0a51f4522f35bd40 100644 (file)
@@ -114,7 +114,6 @@ is_unixsock_path(const char *path)
 
 
 typedef uint32 ProtocolVersion; /* FE/BE protocol version number */
-typedef ProtocolVersion MsgType;
 
 
 /*
@@ -146,7 +145,7 @@ typedef uint32 AuthRequest;         /* an AUTH_REQ_* code */
 typedef struct CancelRequestPacket
 {
        /* Note that each field is stored in network byte order! */
-       MsgType         cancelRequestCode;      /* code to identify a cancel request */
+       ProtocolVersion cancelRequestCode;      /* code to identify a cancel request */
        uint32          backendPID;             /* PID of client's backend */
        uint8           cancelAuthCode[FLEXIBLE_ARRAY_MEMBER];  /* secret key to
                                                                                                                 * authorize cancel */
index c872a0267f0891560f54c9321cf1528cea351782..f23caf8349d5679b287b5840c512616502d1cf93 100644 (file)
@@ -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;
index 5c88fa92f4e57fb009b0ffe783b3410466d5bd97..ceb3fc5d980424fec1c30b15f99fb3ce5aa1c355 100644 (file)
@@ -1733,7 +1733,6 @@ ModifyTablePath
 ModifyTableState
 MonotonicFunction
 MorphOpaque
-MsgType
 MultiAssignRef
 MultiSortSupport
 MultiSortSupportData