Re: BUG #1671: Long interval string representation rejected
| От | Tom Lane |
|---|---|
| Тема | Re: BUG #1671: Long interval string representation rejected |
| Дата | |
| Msg-id | 20383.1116944094@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: BUG #1671: Long interval string representation rejected (Neil Conway <neilc@samurai.com>) |
| Ответы |
Re: BUG #1671: Long interval string representation rejected
Re: BUG #1671: Long interval string representation rejected |
| Список | pgsql-bugs |
Neil Conway <neilc@samurai.com> writes:
> Attached is a patch that implements this. I'm not especially happy about
> the implementation: defining _two_ local macros (that both
> doubly-evaluate one of their arguments) is pretty ugly, but I didn't see
> a cleaner alternative -- suggestions welcome.
Considering that you're incrementing bufptr inside the macro, it hardly
seems that double-evaluation is a problem: the argument pretty much has
to be a variable. OTOH there is no reason for the input argument to be
treated that way. I'd suggest just one macro
#define APPEND_CHAR(bufptr, end, newchar) \
do \
{ \
if (((bufptr) + 1) >= (end)) \
return DTERR_BAD_FORMAT; \
*(bufptr)++ = (newchar); \
} while (0);
used as
APPEND_CHAR(bufp, bufend, *cp++);
APPEND_CHAR(bufp, bufend, pg_tolower((unsigned char) *cp++));
respectively.
regards, tom lane
В списке pgsql-bugs по дате отправления: