From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: reading uninitialized buffer |
Date: | 2004-02-01 18:43:00 |
Message-ID: | 401D48B4.2040808@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
OK, then *This* patch does it the way I think is clearest. Most of it is
just reindenting.
cheers
andrew
Dennis Bjorklund wrote:
>On Sun, 1 Feb 2004, Andrew Dunstan wrote:
>
>
>
>>As for the test being outside the "if" statement, it is true that that
>>might waste a few cycles, but it hardly matters.
>>
>>
>
>The cycles are not important. My "fix" wasn't the most optimized either if
>one should count cycles. It was terminating the string twice in some
>cases. That I thought about and came to the conclusion that it was not
>important. That I didn't rewrite the strncmp() to strcmp() is strange to
>me, the length is obviously not needed. Good thing you looked at it.
>
>
>
>>Personally, I would prefer to replace the if statement with this:
>>
>> if (c == EOF || c == '\n')
>> {
>> *buf = '\0';
>> return;
>> }
>>
>>and then it wouldn't be an issue at all, but I know some people don't
>>like early function returns - is there a general postgres style rule
>>
>>
>
>I don't know what the style rules say. I have nothing against early
>returns if used with grace. Early exits for odd cases, before the main
>part of the function, just helps readability if you ask me. On the other
>hand it does not matter since the correct is always to use whatever style
>the rest of the program uses.
>
>
>
Attachment | Content-Type | Size |
---|---|---|
hba.patch2 | text/plain | 4.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2004-02-01 19:09:44 | Re: Patch for psql startup clarity |
Previous Message | David Fetter | 2004-02-01 18:29:37 | Re: Patch for psql startup clarity |