Re: reading uninitialized buffer
От | Dennis Bjorklund |
---|---|
Тема | Re: reading uninitialized buffer |
Дата | |
Msg-id | Pine.LNX.4.44.0402011557240.30205-100000@zigo.dhs.org обсуждение исходный текст |
Ответ на | Re: reading uninitialized buffer (Andrew Dunstan <andrew@dunslane.net>) |
Ответы |
Re: reading uninitialized buffer
|
Список | pgsql-patches |
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. -- /Dennis Björklund
В списке pgsql-patches по дате отправления: