On Thu, Oct 29, 2020 at 04:40:32PM -0700, Andres Freund wrote: > 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?
Each one of those code paths is working on a different sub-API aiming at fetching a specific piece of TLS information, and the way each sub-API does its lookup at MyProcPort is different. One possible way would be to move the checks on ssl_in_use into a macro for the beginning part. The end part could be improved by making X509_NAME_field_to_text() and such return a text and not a Datum, and move the null check + text-to-datum conversion into a separate macro. I am not sure if this would be an improvement in terms of readability though. -- Michael
signature.asc
Description: PGP signature