summaryrefslogtreecommitdiff
path: root/src/interfaces
diff options
context:
space:
mode:
authorDavid Rowley2019-07-04 01:01:13 +0000
committerDavid Rowley2019-07-04 01:01:13 +0000
commit8abc13a88938ef473b8a486186f1b96630450728 (patch)
tree111864d4f940154a6fd64fd50bc528d396ccde30 /src/interfaces
parent5683b34956b4e8da9dccadc2e3a53b86104ebb33 (diff)
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
Diffstat (limited to 'src/interfaces')
-rw-r--r--src/interfaces/libpq/fe-auth-scram.c14
-rw-r--r--src/interfaces/libpq/fe-connect.c4
-rw-r--r--src/interfaces/libpq/fe-protocol3.c4
3 files changed, 11 insertions, 11 deletions
diff --git a/src/interfaces/libpq/fe-auth-scram.c b/src/interfaces/libpq/fe-auth-scram.c
index babdc061984..04ee43441c8 100644
--- a/src/interfaces/libpq/fe-auth-scram.c
+++ b/src/interfaces/libpq/fe-auth-scram.c
@@ -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,
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index c800d7921e3..d70cf1f9484 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -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
diff --git a/src/interfaces/libpq/fe-protocol3.c b/src/interfaces/libpq/fe-protocol3.c
index 467563d7a41..bbba48bc8b6 100644
--- a/src/interfaces/libpq/fe-protocol3.c
+++ b/src/interfaces/libpq/fe-protocol3.c
@@ -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;
}