Re: BUG #1671: Long interval string representation rejected

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: Mark Dilger <markdilger(at)yahoo(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1671: Long interval string representation rejected
Date: 2005-05-24 14:14:54
Message-ID: 20383.1116944094@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Neil Conway <neilc(at)samurai(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Haluk GUNCER 2005-05-24 15:22:31 BUG #1678: pw_shadow BUS ERROR
Previous Message Szűcs Gábor 2005-05-24 11:55:21 Re: [SQL] could not devise a query plan