From ba6cc0ba4d387015d64a98a37eb72188191c3672 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Fri, 2 Feb 2024 13:17:25 +0100 Subject: [PATCH 4/4] Wording, whitespace changes --- doc/src/sgml/libpq.sgml | 8 ++++---- src/interfaces/libpq/fe-cancel.c | 9 +++------ src/interfaces/libpq/fe-connect.c | 12 ++++++------ 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml index 8648379f8d..81b4028381 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -6052,7 +6052,7 @@ PGcancelConn *PQcancelConn(PGconn *conn); connection. A cancel request can be sent over this connection in a blocking manner using and in a non-blocking manner using . - The return value should can be passed to , + The return value can be passed to to check if the PGcancelConn object was created successfully. The PGcancelConn object is an opaque structure that is not meant to be accessed directly by the @@ -6150,9 +6150,9 @@ ConnStatusType PQcancelStatus(const PGcancelConn *conn); returns CONNECTION_OK for a PGcancelConn it means that that the dispatch of the cancel request has completed (although this is no promise that the query was actually canceled) and that the - connection is now closed. While a CONNECTION_OK result - for PGconn means that queries can be sent over - the connection. + cancel connection is now closed, while a CONNECTION_OK + result for PGconn means that queries can be + sent over the connection. diff --git a/src/interfaces/libpq/fe-cancel.c b/src/interfaces/libpq/fe-cancel.c index d75c9628e7..6420384be7 100644 --- a/src/interfaces/libpq/fe-cancel.c +++ b/src/interfaces/libpq/fe-cancel.c @@ -51,7 +51,6 @@ PQcancelConn(PGconn *conn) return (PGcancelConn *) cancelConn; } - /* * Indicate that this connection is used to send a cancellation */ @@ -223,20 +222,19 @@ PQcancelPoll(PGcancelConn *cancelConn) #endif /* - * We don't expect any data, only connection closure. So if we strangly do + * We don't expect any data, only connection closure. So if we strangely do * receive some data we consider that an error. */ if (n > 0) { - libpq_append_conn_error(conn, "received unexpected response from server"); conn->status = CONNECTION_BAD; return PGRES_POLLING_FAILED; } /* - * Getting here means that we received an EOF. Which is what we were - * expecting. The cancel request has completed. + * Getting here means that we received an EOF, which is what we were + * expecting -- the cancel request has completed. */ cancelConn->conn.status = CONNECTION_OK; resetPQExpBuffer(&conn->errorMessage); @@ -304,7 +302,6 @@ PQcancelFinish(PGcancelConn *cancelConn) PQfinish((PGconn *) cancelConn); } - /* * PQgetCancel: get a PGcancel structure corresponding to a connection. * diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index 4add35ec5c..4f9b2182db 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -618,9 +618,9 @@ pqDropServerData(PGconn *conn) conn->write_err_msg = NULL; /* - * Cancel connections should save their be_pid and be_key across - * PQcancelReset invocations. Otherwise they would not have access to the - * secret token of the connection they are supposed to cancel anymore. + * Cancel connections need to retain their be_pid and be_key across + * PQcancelReset invocations, otherwise they would not have access to the + * secret token of the connection they are supposed to cancel. */ if (!conn->cancelRequest) { @@ -648,8 +648,8 @@ pqDropServerData(PGconn *conn) * PQconnectStart or PQconnectStartParams (which differ in the same way as * PQconnectdb and PQconnectdbParams) and PQconnectPoll. * - * Internally, the static functions pqConnectDBStart, pqConnectDBComplete - * are part of the connection procedure. + * The non-exported functions pqConnectDBStart, pqConnectDBComplete are + * part of the connection procedure implementation. */ /* @@ -2358,7 +2358,7 @@ pqConnectDBStart(PGconn *conn) * anything else looks at it.) * * Cancel requests are special though, they should only try one host and - * address. These fields have already set up in PQcancelConn. So leave + * address, and these fields have already set up in PQcancelConn, so leave * these fields alone for cancel requests. */ if (!conn->cancelRequest) -- 2.39.2