Neil Conway <[EMAIL PROTECTED]> 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

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to