Re: appendStringInfo vs appendStringInfoString

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: appendStringInfo vs appendStringInfoString
Date: 2013-09-28 11:44:22
Message-ID: 20130928114422.GA2670970@alap2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2013-09-28 14:11:29 +0300, Heikki Linnakangas wrote:
> On 28.09.2013 12:44, David Rowley wrote:
> >The macro for test 4 was as follows:
> >#define appendStringInfoStringConst(buf, s) appendBinaryStringInfo(buf,
> >(s), sizeof(s)-1)
>
> If that makes any difference in practice, I wonder if we should just do:
>
> #define appendStringInfoString(buf, s) appendBinaryStringInfo(buf, (s),
> strlen(s))

Doesn't that have a bit too much of an multiple evaluation danger? Maybe
make it a static inline in the header instead for the platforms that
support it?

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Marko Tiikkaja 2013-09-28 12:42:21 Re: plpgsql.print_strict_params
Previous Message David Rowley 2013-09-28 11:40:47 Re: appendStringInfo vs appendStringInfoString