Re: Assert for frontend programs?
От | Tom Lane |
---|---|
Тема | Re: Assert for frontend programs? |
Дата | |
Msg-id | 6295.1355518109@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Assert for frontend programs? (Andrew Dunstan <andrew@dunslane.net>) |
Список | pgsql-hackers |
Andrew Dunstan <andrew@dunslane.net> writes: > I noticed, BTW, that there are one or two places in backend code that > seem to call plain assert unconditionally, notably src/port/open.c, > src/backend/utils/adt/inet_net_pton.c and some contrib modules. That > seems undesirable. Should we need to look at turning these into Assert > calls? Yeah, possibly. The inet_net_pton.c case is surely because it was that way in the BIND code we borrowed; perhaps the others are the same story. I don't object to changing them, since we don't seem to be actively adopting any new upstream versions; but again I can't get too excited. > - psql_assert(!*text); > + Assert(*text != '\0'); I think you got that one backwards. > #include "c.h" > +#ifdef USE_ASSERT_CHECKING > +#include <assert.h> > +#define Assert(p) assert(p) > +#else > +#define Assert(p) > +#endif Perhaps a comment would be in order here? Specifically something about providing Assert() so that it can be used in both backend and frontend code? regards, tom lane
В списке pgsql-hackers по дате отправления: