Hi,
Thanks for extracting these.
On 2020-10-29 23:48:57 +0100, Daniel Gustafsson wrote:>
> /*
> @@ -54,9 +53,16 @@ PG_FUNCTION_INFO_V1(ssl_version);
> Datum
> ssl_version(PG_FUNCTION_ARGS)
> {
> - if (MyProcPort->ssl == NULL)
> + const char *version;
> +
> + if (!MyProcPort->ssl_in_use)
> + PG_RETURN_NULL();
> +
> + version = be_tls_get_version(MyProcPort);
> + if (version == NULL)
> PG_RETURN_NULL();
> - PG_RETURN_TEXT_P(cstring_to_text(SSL_get_version(MyProcPort->ssl)));
> +
> + PG_RETURN_TEXT_P(cstring_to_text(version));
> }
There's quite a few copies of this code that look exactly the same,
except for the be_tls_get_* call. Do you see a way to have fewer copies
of the same code?
Greetings,
Andres Freund