mirror of
https://github.com/postgres/postgres.git
synced 2025-08-25 20:23:07 +03:00
Use appendStringInfoString and appendPQExpBufferStr where possible
This changes various places where appendPQExpBuffer was used in places where it was possible to use appendPQExpBufferStr, and likewise for appendStringInfo and appendStringInfoString. This is really just a stylistic improvement, but there are also small performance gains to be had from doing this. Discussion: http://postgr.es/m/CAKJS1f9P=M-3ULmPvr8iCno8yvfDViHibJjpriHU8+SXUgeZ=w@mail.gmail.com
This commit is contained in:
@@ -346,7 +346,7 @@ build_client_first_message(fe_scram_state *state)
|
||||
if (strcmp(state->sasl_mechanism, SCRAM_SHA_256_PLUS_NAME) == 0)
|
||||
{
|
||||
Assert(conn->ssl_in_use);
|
||||
appendPQExpBuffer(&buf, "p=tls-server-end-point");
|
||||
appendPQExpBufferStr(&buf, "p=tls-server-end-point");
|
||||
}
|
||||
#ifdef HAVE_PGTLS_GET_PEER_CERTIFICATE_HASH
|
||||
else if (conn->ssl_in_use)
|
||||
@@ -354,7 +354,7 @@ build_client_first_message(fe_scram_state *state)
|
||||
/*
|
||||
* Client supports channel binding, but thinks the server does not.
|
||||
*/
|
||||
appendPQExpBuffer(&buf, "y");
|
||||
appendPQExpBufferChar(&buf, 'y');
|
||||
}
|
||||
#endif
|
||||
else
|
||||
@@ -362,7 +362,7 @@ build_client_first_message(fe_scram_state *state)
|
||||
/*
|
||||
* Client does not support channel binding.
|
||||
*/
|
||||
appendPQExpBuffer(&buf, "n");
|
||||
appendPQExpBufferChar(&buf, 'n');
|
||||
}
|
||||
|
||||
if (PQExpBufferDataBroken(buf))
|
||||
@@ -437,7 +437,7 @@ build_client_final_message(fe_scram_state *state)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
appendPQExpBuffer(&buf, "c=");
|
||||
appendPQExpBufferStr(&buf, "c=");
|
||||
|
||||
/* p=type,, */
|
||||
cbind_header_len = strlen("p=tls-server-end-point,,");
|
||||
@@ -475,10 +475,10 @@ build_client_final_message(fe_scram_state *state)
|
||||
}
|
||||
#ifdef HAVE_PGTLS_GET_PEER_CERTIFICATE_HASH
|
||||
else if (conn->ssl_in_use)
|
||||
appendPQExpBuffer(&buf, "c=eSws"); /* base64 of "y,," */
|
||||
appendPQExpBufferStr(&buf, "c=eSws"); /* base64 of "y,," */
|
||||
#endif
|
||||
else
|
||||
appendPQExpBuffer(&buf, "c=biws"); /* base64 of "n,," */
|
||||
appendPQExpBufferStr(&buf, "c=biws"); /* base64 of "n,," */
|
||||
|
||||
if (PQExpBufferDataBroken(buf))
|
||||
goto oom_error;
|
||||
@@ -496,7 +496,7 @@ build_client_final_message(fe_scram_state *state)
|
||||
state->client_final_message_without_proof,
|
||||
client_proof);
|
||||
|
||||
appendPQExpBuffer(&buf, ",p=");
|
||||
appendPQExpBufferStr(&buf, ",p=");
|
||||
if (!enlargePQExpBuffer(&buf, pg_b64_enc_len(SCRAM_KEY_LEN)))
|
||||
goto oom_error;
|
||||
buf.len += pg_b64_encode((char *) client_proof,
|
||||
|
@@ -2772,8 +2772,8 @@ keep_going: /* We will come back to here until there is
|
||||
}
|
||||
else if (!conn->gctx && conn->gssencmode[0] == 'r')
|
||||
{
|
||||
appendPQExpBuffer(&conn->errorMessage,
|
||||
libpq_gettext("GSSAPI encryption required, but was impossible (possibly no ccache, no server support, or using a local socket)\n"));
|
||||
appendPQExpBufferStr(&conn->errorMessage,
|
||||
libpq_gettext("GSSAPI encryption required, but was impossible (possibly no ccache, no server support, or using a local socket)\n"));
|
||||
goto error_return;
|
||||
}
|
||||
#endif
|
||||
|
@@ -996,7 +996,7 @@ pqBuildErrorMessage3(PQExpBuffer msg, const PGresult *res,
|
||||
/* If we couldn't allocate a PGresult, just say "out of memory" */
|
||||
if (res == NULL)
|
||||
{
|
||||
appendPQExpBuffer(msg, libpq_gettext("out of memory\n"));
|
||||
appendPQExpBufferStr(msg, libpq_gettext("out of memory\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1009,7 +1009,7 @@ pqBuildErrorMessage3(PQExpBuffer msg, const PGresult *res,
|
||||
if (res->errMsg && res->errMsg[0])
|
||||
appendPQExpBufferStr(msg, res->errMsg);
|
||||
else
|
||||
appendPQExpBuffer(msg, libpq_gettext("no error message available\n"));
|
||||
appendPQExpBufferStr(msg, libpq_gettext("no error message available\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user