Re: cleanup in code

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: cleanup in code
Дата
Msg-id CAApHDvpCv8kb3S9guBmDjby5wfcMp-4WhZLxKtjK6vGqOK8h9A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: cleanup in code  (Amit Kapila <amit.kapila16@gmail.com>)
Ответы Re: cleanup in code  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Tue, Jan 7, 2014 at 7:46 PM, Amit Kapila <amit.kapila16@gmail.com> wrote:
Having said above, I think there must be a reason to have elevel_ which I am
not aware.


I think it will be like Andres said up thread, to stop multiple evaluations of the expression passed to the macro.

If someone did:

elog(mylevel++, "Something bad just happened");

With assigning this to a variable the user will have the mylevel increase by 1, but if we didn't then it would get increase more times.

I didn't look at all the elog usages in core, but my guess is that we're probably not using any expressions like this in elog, but we can't really speak for any third party code which uses the macro. Likely to get rid of that variable something would have to go into the release notes to get users to check for volatile expressions being used in elog and fix them up.

The only other way to fix it that I can think of is the patch you posted above which is pretty much the same one as I posted on the other thread too.

Regards

David Rowley 

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: cleanup in code
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: Long paths for tablespace leads to uninterruptible hang in Windows