Re: implement subject alternative names support for SSL connections - Mailing list pgsql-hackers

From Tom Lane
Subject Re: implement subject alternative names support for SSL connections
Date
Msg-id 27727.1406317932@sss.pgh.pa.us
Whole thread Raw
In response to Re: implement subject alternative names support for SSL connections  (Magnus Hagander <magnus@hagander.net>)
List pgsql-hackers
Magnus Hagander <magnus@hagander.net> writes:
> On Fri, Jul 25, 2014 at 7:15 PM, Alexey Klyukin <alexk@hintbits.com> wrote:
>> On Fri, Jul 25, 2014 at 6:34 PM, Magnus Hagander <magnus@hagander.net>
>>> Why keep looping once you've found a match? When you set result=true
>>> you should break; from the loop I think. Not necessarily for
>>> performance, but there might be something about a different extension
>>> we can't parse for example, no need to fail in that case.

>> The for loop header is for (i = 0; i < alt_names_total && !result; i++), so
>> the loop
>> should terminate right when the result becomes true, which happens if the
>> pg_strcasecmp
>> finds a match between the given dNSName and the name supplied by the client.

> oh, ha. So yeah, that was too quick to count as a review - clearly :)

FWIW, I find that type of loop coding to be extremely poor style,
precisely because it's not too readable.  A break in the loop body is
*far* more obvious to the reader.  (Not to mention that it doesn't
add overhead to the loop on iterations where you can't break.)
        regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Performance issue in pg_dump's dependency loop searching
Next
From: "Baker, Keith [OCDUS Non-J&J]"
Date:
Subject: Proposal to add a QNX 6.5 port to PostgreSQL