diff options
author | David Rowley <drowley@postgresql.org> | 2019-07-04 13:01:13 +1200 |
---|---|---|
committer | David Rowley <drowley@postgresql.org> | 2019-07-04 13:01:13 +1200 |
commit | 8abc13a88938ef473b8a486186f1b96630450728 (patch) | |
tree | 111864d4f940154a6fd64fd50bc528d396ccde30 /src/interfaces/libpq/fe-auth-scram.c | |
parent | 5683b34956b4e8da9dccadc2e3a53b86104ebb33 (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/libpq/fe-auth-scram.c')
-rw-r--r-- | src/interfaces/libpq/fe-auth-scram.c | 14 |
1 files changed, 7 insertions, 7 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, |